Merge from mainline.
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Apr 2011 18:42:31 +0000 (11:42 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Apr 2011 18:42:31 +0000 (11:42 -0700)
34 files changed:
ChangeLog
admin/ChangeLog
admin/MAINTAINERS
lib/allocator.c [new file with mode: 0644]
lib/allocator.h
lib/careadlinkat.c
lib/gnulib.mk
lib/stdlib.in.h
lisp/ChangeLog
lisp/emacs-lisp/find-gc.el
m4/gl-comp.m4
src/ChangeLog
src/Makefile.in
src/category.c
src/charset.c
src/coding.c
src/deps.mk
src/doc.c
src/doprnt.c [deleted file]
src/eval.c
src/fns.c
src/intervals.c
src/keyboard.c
src/lisp.h
src/m/amdx86-64.h
src/m/ia64.h
src/m/ibms390x.h
src/nsfns.m
src/sysdep.c
src/term.c
src/window.c
src/xdisp.c
src/xfns.c
src/xterm.c

index b1d1d65..b766dbe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lib/allocator.c: New file, automatically generated by gnulib.
+
 2011-04-07  Glenn Morris  <rgm@gnu.org>
 
        * autogen/update_autogen: Ignore comment diffs in ldefs-boot.el.
index 853c194..f58a759 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove the doprnt implementation, as Emacs now uses vsnprintf.
+       * MAINTAINERS: Remove src/doprnt.c.
+
 2011-03-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.3 released.
index 1d988a2..8fb6f59 100644 (file)
@@ -145,7 +145,6 @@ src/config.in
 src/data.c
 src/dispnew.c
 src/doc.c
-src/doprnt.c
 src/ecrt0.c
 src/emacs.c
 src/epaths.in
@@ -215,4 +214,3 @@ src/xmenu.c
 src/xrdb.c
 src/xselect.c
 src/xterm.c
-
diff --git a/lib/allocator.c b/lib/allocator.c
new file mode 100644 (file)
index 0000000..2c1a3da
--- /dev/null
@@ -0,0 +1,5 @@
+#define _GL_USE_STDLIB_ALLOC 1
+#include <config.h>
+#include "allocator.h"
+#include <stdlib.h>
+struct allocator const stdlib_allocator = { malloc, realloc, free, NULL };
index 4ac863b..a89ba32 100644 (file)
@@ -30,16 +30,16 @@ struct allocator
      attributes do not work with pointers to functions.  See
      <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00007.html>.  */
 
-  /* Call MALLOC to allocate memory, like 'malloc'.  On failure MALLOC
+  /* Call ALLOCATE to allocate memory, like 'malloc'.  On failure ALLOCATE
      should return NULL, though not necessarily set errno.  When given
      a zero size it may return NULL even if successful.  */
-  void *(*malloc) (size_t);
+  void *(*allocate) (size_t);
 
-  /* If nonnull, call REALLOC to reallocate memory, like 'realloc'.
-     On failure REALLOC should return NULL, though not necessarily set
+  /* If nonnull, call REALLOCATE to reallocate memory, like 'realloc'.
+     On failure REALLOCATE should return NULL, though not necessarily set
      errno.  When given a zero size it may return NULL even if
      successful.  */
-  void *(*realloc) (void *, size_t);
+  void *(*reallocate) (void *, size_t);
 
   /* Call FREE to free memory, like 'free'.  */
   void (*free) (void *);
@@ -50,4 +50,7 @@ struct allocator
   void (*die) (void);
 };
 
+/* An allocator using the stdlib functions and a null DIE function.  */
+extern struct allocator const stdlib_allocator;
+
 #endif
index 15ffe24..7a7806d 100644 (file)
 
 #include <errno.h>
 #include <limits.h>
-#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
-/* Use the system functions, not the gnulib overrides, because this
-   module does not depend on GNU or POSIX semantics.  */
-#undef malloc
-#undef realloc
-
 /* Define this independently so that stdint.h is not a prerequisite.  */
 #ifndef SIZE_MAX
 # define SIZE_MAX ((size_t) -1)
@@ -57,11 +51,6 @@ careadlinkatcwd (int fd, char const *filename, char *buffer,
 }
 #endif
 
-/* A standard allocator.  For now, only careadlinkat needs this, but
-   perhaps it should be moved to the allocator module.  */
-static struct allocator const standard_allocator =
-  { malloc, realloc, free, NULL };
-
 /* Assuming the current directory is FD, get the symbolic link value
    of FILENAME as a null-terminated string and put it into a buffer.
    If FD is AT_FDCWD, FILENAME is interpreted relative to the current
@@ -94,7 +83,7 @@ careadlinkat (int fd, char const *filename,
   char stack_buf[1024];
 
   if (! alloc)
-    alloc = &standard_allocator;
+    alloc = &stdlib_allocator;
 
   if (! buffer_size)
     {
@@ -138,16 +127,16 @@ careadlinkat (int fd, char const *filename,
 
           if (buf == stack_buf)
             {
-              char *b = (char *) alloc->malloc (link_size);
+              char *b = (char *) alloc->allocate (link_size);
               if (! b)
                 break;
               memcpy (b, buf, link_size);
               buf = b;
             }
-          else if (link_size < buf_size && buf != buffer && alloc->realloc)
+          else if (link_size < buf_size && buf != buffer && alloc->reallocate)
             {
               /* Shrink BUF before returning it.  */
-              char *b = (char *) alloc->realloc (buf, link_size);
+              char *b = (char *) alloc->reallocate (buf, link_size);
               if (b)
                 buf = b;
             }
@@ -164,7 +153,7 @@ careadlinkat (int fd, char const *filename,
         buf_size = buf_size_max;
       else
         break;
-      buf = (char *) alloc->malloc (buf_size);
+      buf = (char *) alloc->allocate (buf_size);
     }
   while (buf);
 
index d2fd669..1938c61 100644 (file)
@@ -21,6 +21,14 @@ libgnu_a_LIBADD = $(gl_LIBOBJS)
 libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
 EXTRA_libgnu_a_SOURCES =
 
+## begin gnulib module allocator
+
+libgnu_a_SOURCES += allocator.c
+
+EXTRA_DIST += allocator.h
+
+## end   gnulib module allocator
+
 ## begin gnulib module arg-nonnull
 
 # The BUILT_SOURCES created by this Makefile snippet are not used via #include
@@ -73,7 +81,7 @@ EXTRA_DIST += $(top_srcdir)/./c++defs.h
 
 libgnu_a_SOURCES += careadlinkat.c
 
-EXTRA_DIST += allocator.h careadlinkat.h
+EXTRA_DIST += careadlinkat.h
 
 ## end   gnulib module careadlinkat
 
index 2697a4b..b9ada2c 100644 (file)
@@ -255,9 +255,14 @@ _GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
 # endif
 #endif
 
+/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
+   rely on GNU or POSIX semantics for malloc and realloc (for example,
+   by never specifying a zero size), so it does not need malloc or
+   realloc to be redefined.  */
 #if @GNULIB_MALLOC_POSIX@
 # if @REPLACE_MALLOC@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
+        || _GL_USE_STDLIB_ALLOC)
 #   undef malloc
 #   define malloc rpl_malloc
 #  endif
@@ -267,7 +272,7 @@ _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
 # endif
 _GL_CXXALIASWARN (malloc);
-#elif defined GNULIB_POSIXCHECK
+#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
 # undef malloc
 /* Assume malloc is always declared.  */
 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
@@ -531,7 +536,8 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
 
 #if @GNULIB_REALLOC_POSIX@
 # if @REPLACE_REALLOC@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
+        || _GL_USE_STDLIB_ALLOC)
 #   undef realloc
 #   define realloc rpl_realloc
 #  endif
@@ -541,7 +547,7 @@ _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
 # endif
 _GL_CXXALIASWARN (realloc);
-#elif defined GNULIB_POSIXCHECK
+#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
 # undef realloc
 /* Assume realloc is always declared.  */
 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
index 8d705cd..62dd255 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove the doprnt implementation, as Emacs now uses vsnprintf.
+       * emacs-lisp/find-gc.el (find-gc-source-files): Remove doprnt.c.
+
 2011-04-08  Sho Nakatani <lay.sakura@gmail.com>
 
        * doc-view.el (doc-view-fit-width-to-window)
index 1de3862..c9ca03c 100644 (file)
@@ -60,7 +60,7 @@ Each entry has the form (FUNCTION . FUNCTIONS-IT-CALLS).")
     "alloc.c" "data.c" "doc.c" "editfns.c"
     "callint.c" "eval.c" "fns.c" "print.c" "lread.c"
     "abbrev.c" "syntax.c" "unexcoff.c"
-    "bytecode.c" "process.c" "callproc.c" "doprnt.c"
+    "bytecode.c" "process.c" "callproc.c"
     "x11term.c" "x11fns.c"))
 
 
index 43cce9b..3ca40ee 100644 (file)
@@ -26,6 +26,7 @@ AC_DEFUN([gl_EARLY],
   m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
   m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
   AC_REQUIRE([AC_PROG_RANLIB])
+  # Code from module allocator:
   # Code from module arg-nonnull:
   # Code from module c++defs:
   # Code from module careadlinkat:
@@ -79,6 +80,7 @@ AC_DEFUN([gl_INIT],
   m4_pushdef([gl_LIBSOURCES_DIR], [])
   gl_COMMON
   gl_source_base='lib'
+  # Code from module allocator:
   # Code from module arg-nonnull:
   # Code from module c++defs:
   # Code from module careadlinkat:
@@ -293,6 +295,7 @@ AC_DEFUN([gl_FILE_LIST], [
   build-aux/arg-nonnull.h
   build-aux/c++defs.h
   build-aux/warn-on-use.h
+  lib/allocator.c
   lib/allocator.h
   lib/careadlinkat.c
   lib/careadlinkat.h
index e7ea077..cd1b74b 100644 (file)
@@ -1,3 +1,56 @@
+2011-04-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * eval.c: Port to Windows vsnprintf (Bug#8435).
+       Include <limits.h>.
+       (SIZE_MAX): Define if the headers do not.
+       (verror): Do not give up if vsnprintf returns a negative count.
+       Instead, grow the buffer.  This ports to Windows vsnprintf, which
+       does not conform to C99.  Problem reported by Eli Zaretskii.
+       Also, simplify the allocation scheme, by avoiding the need for
+       calling realloc, and removing the ALLOCATED variable.
+
+       * eval.c (verror): Initial buffer size is 4000 (not 200) bytes.
+
+       Remove the doprnt implementation, as Emacs now uses vsnprintf.
+       * doprnt.c: Remove.
+       * lisp.h (doprnt): Remove.
+       * Makefile.in (base_obj): Remove doprnt.o.
+       * deps.mk (doprnt.o): Remove.
+
+       error: Print 32- and 64-bit integers portably (Bug#8435).
+       Without this change, on typical 64-bit hosts error ("...%d...", N)
+       was used to print both 32- and 64-bit integers N, which relied on
+       undefined behavior.
+       * lisp.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h (pEd):
+       New macro.
+       * lisp.h (error, verror): Mark as printf-like functions.
+       * eval.c (verror): Use vsnprintf, not doprnt, to do the real work.
+       Report overflow in size calculations when allocating printf buffer.
+       Do not truncate output string at its first null byte.
+       * xdisp.c (vmessage): Use vsnprintf, not doprnt, to do the real work.
+       Truncate the output at a character boundary, since vsnprintf does not
+       do that.
+       * charset.c (check_iso_charset_parameter): Convert internal
+       character to string before calling 'error', since %c now has the
+       printf meaning.
+       * coding.c (Fdecode_sjis_char, Fdecode_big5_char): Avoid int
+       overflow when computing char to be passed to 'error'.  Do not
+       pass Lisp_Object to 'error'; pass the integer instead.
+       * nsfns.m (Fns_do_applescript): Use int, not long, since it's
+       formatted with plain %d.
+
+       * eval.c (internal_lisp_condition_case): Don't pass spurious arg.
+
+       * keyboard.c (access_keymap_keyremap): Print func name, not garbage.
+
+       * coding.c (Fdecode_sjis_char): Don't assume CODE fits in int.
+
+       * xterm.c (x_catch_errors): Remove duplicate declaration.
+
+       * term.c (maybe_fatal): Mark its 3rd arg as a printf format, too.
+
+       * xdisp.c, lisp.h (message_nolog): Remove; unused.
+
 2011-04-09  Chong Yidong  <cyd@stupidchicken.com>
 
        * ftfont.c (get_adstyle_property, ftfont_pattern_entity): Use
index e119596..154d6ab 100644 (file)
@@ -354,7 +354,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
        syntax.o $(UNEXEC_OBJ) bytecode.o \
        process.o gnutls.o callproc.o \
        region-cache.o sound.o atimer.o \
-       doprnt.o intervals.o textprop.o composite.o xml.o \
+       intervals.o textprop.o composite.o xml.o \
        $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ)
 obj = $(base_obj) $(NS_OBJC_OBJ)
 
index cc7ff88..bba0303 100644 (file)
@@ -128,7 +128,7 @@ the current buffer's category table.  */)
   table = check_category_table (table);
 
   if (!NILP (CATEGORY_DOCSTRING (table, XFASTINT (category))))
-    error ("Category `%c' is already defined", XFASTINT (category));
+    error ("Category `%c' is already defined", (int) XFASTINT (category));
   if (!NILP (Vpurify_flag))
     docstring = Fpurecopy (docstring);
   CATEGORY_DOCSTRING (table, XFASTINT (category)) = docstring;
@@ -373,7 +373,7 @@ then delete CATEGORY from the category set instead of adding it.  */)
   table = check_category_table (table);
 
   if (NILP (CATEGORY_DOCSTRING (table, XFASTINT (category))))
-    error ("Undefined category: %c", XFASTINT (category));
+    error ("Undefined category: %c", (int) XFASTINT (category));
 
   set_value = NILP (reset) ? Qt : Qnil;
 
index 32836d4..55cbfc4 100644 (file)
@@ -493,7 +493,7 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co
   unbind_to (count, Qnil);
   if (fd < 0
       || ! (fp = fdopen (fd, "r")))
-    error ("Failure in loading charset map: %S", SDATA (mapfile));
+    error ("Failure in loading charset map: %s", SDATA (mapfile));
 
   /* Use SAFE_ALLOCA instead of alloca, as `charset_map_entries' is
      large (larger than MAX_ALLOCA).  */
@@ -1000,7 +1000,7 @@ usage: (define-charset-internal ...)  */)
     {
       CHECK_NUMBER (val);
       if (XINT (val) < '0' || XINT (val) > 127)
-       error ("Invalid iso-final-char: %d", XINT (val));
+       error ("Invalid iso-final-char: %"pEd, XINT (val));
       charset.iso_final = XINT (val);
     }
 
@@ -1022,7 +1022,7 @@ usage: (define-charset-internal ...)  */)
     {
       CHECK_NATNUM (val);
       if ((XINT (val) > 0 && XINT (val) <= 128) || XINT (val) >= 256)
-       error ("Invalid emacs-mule-id: %d", XINT (val));
+       error ("Invalid emacs-mule-id: %"pEd, XINT (val));
       charset.emacs_mule_id = XINT (val);
     }
 
@@ -1440,11 +1440,17 @@ check_iso_charset_parameter (Lisp_Object dimension, Lisp_Object chars, Lisp_Obje
   CHECK_NATNUM (final_char);
 
   if (XINT (dimension) > 3)
-    error ("Invalid DIMENSION %d, it should be 1, 2, or 3", XINT (dimension));
+    error ("Invalid DIMENSION %"pEd", it should be 1, 2, or 3",
+          XINT (dimension));
   if (XINT (chars) != 94 && XINT (chars) != 96)
-    error ("Invalid CHARS %d, it should be 94 or 96", XINT (chars));
+    error ("Invalid CHARS %"pEd", it should be 94 or 96", XINT (chars));
   if (XINT (final_char) < '0' || XINT (final_char) > '~')
-    error ("Invalid FINAL-CHAR %c, it should be `0'..`~'", XINT (chars));
+    {
+      unsigned char str[MAX_MULTIBYTE_LENGTH + 1];
+      int len = CHAR_STRING (XINT (chars), str);
+      str[len] = '\0';
+      error ("Invalid FINAL-CHAR %s, it should be `0'..`~'", str);
+    }
 }
 
 
index a2e90e6..711ada5 100644 (file)
@@ -9024,14 +9024,15 @@ Return the corresponding character.  */)
 {
   Lisp_Object spec, attrs, val;
   struct charset *charset_roman, *charset_kanji, *charset_kana, *charset;
+  EMACS_INT ch;
   int c;
 
   CHECK_NATNUM (code);
-  c = XFASTINT (code);
+  ch = XFASTINT (code);
   CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec);
   attrs = AREF (spec, 0);
 
-  if (ASCII_BYTE_P (c)
+  if (ASCII_BYTE_P (ch)
       && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
     return code;
 
@@ -9040,26 +9041,31 @@ Return the corresponding character.  */)
   charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
   charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val)));
 
-  if (c <= 0x7F)
-    charset = charset_roman;
-  else if (c >= 0xA0 && c < 0xDF)
+  if (ch <= 0x7F)
     {
+      c = ch;
+      charset = charset_roman;
+    }
+  else if (ch >= 0xA0 && ch < 0xDF)
+    {
+      c = ch - 0x80;
       charset = charset_kana;
-      c -= 0x80;
     }
   else
     {
-      int c1 = c >> 8, c2 = c & 0xFF;
+      EMACS_INT c1 = ch >> 8;
+      int c2 = ch & 0xFF;
 
       if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF
          || c2 < 0x40 || c2 == 0x7F || c2 > 0xFC)
-       error ("Invalid code: %d", code);
+       error ("Invalid code: %"pEd, ch);
+      c = ch;
       SJIS_TO_JIS (c);
       charset = charset_kanji;
     }
   c = DECODE_CHAR (charset, c);
   if (c < 0)
-    error ("Invalid code: %d", code);
+    error ("Invalid code: %"pEd, ch);
   return make_number (c);
 }
 
@@ -9099,14 +9105,15 @@ Return the corresponding character.  */)
 {
   Lisp_Object spec, attrs, val;
   struct charset *charset_roman, *charset_big5, *charset;
+  EMACS_INT ch;
   int c;
 
   CHECK_NATNUM (code);
-  c = XFASTINT (code);
+  ch = XFASTINT (code);
   CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec);
   attrs = AREF (spec, 0);
 
-  if (ASCII_BYTE_P (c)
+  if (ASCII_BYTE_P (ch)
       && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
     return code;
 
@@ -9114,19 +9121,24 @@ Return the corresponding character.  */)
   charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
   charset_big5 = CHARSET_FROM_ID (XINT (XCAR (val)));
 
-  if (c <= 0x7F)
-    charset = charset_roman;
+  if (ch <= 0x7F)
+    {
+      c = ch;
+      charset = charset_roman;
+    }
   else
     {
-      int b1 = c >> 8, b2 = c & 0x7F;
+      EMACS_INT b1 = ch >> 8;
+      int b2 = ch & 0x7F;
       if (b1 < 0xA1 || b1 > 0xFE
          || b2 < 0x40 || (b2 > 0x7E && b2 < 0xA1) || b2 > 0xFE)
-       error ("Invalid code: %d", code);
+       error ("Invalid code: %"pEd, ch);
+      c = ch;
       charset = charset_big5;
     }
-  c = DECODE_CHAR (charset, (unsigned )c);
+  c = DECODE_CHAR (charset, c);
   if (c < 0)
-    error ("Invalid code: %d", code);
+    error ("Invalid code: %"pEd, ch);
   return make_number (c);
 }
 
@@ -9298,7 +9310,7 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS...)  */)
        || (EQ (operation, Qinsert_file_contents) && CONSP (target)
            && STRINGP (XCAR (target)) && BUFFERP (XCDR (target)))
        || (EQ (operation, Qopen_network_stream) && INTEGERP (target))))
-    error ("Invalid %dth argument", XFASTINT (target_idx) + 1);
+    error ("Invalid %"pEd"th argument", XFASTINT (target_idx) + 1);
   if (CONSP (target))
     target = XCAR (target);
 
@@ -9774,7 +9786,7 @@ usage: (define-coding-system-internal ...)  */)
          CHECK_CHARSET_GET_ID (tmp1, id);
          CHECK_NATNUM_CDR (val);
          if (XINT (XCDR (val)) >= 4)
-           error ("Invalid graphic register number: %d", XINT (XCDR (val)));
+           error ("Invalid graphic register number: %"pEd, XINT (XCDR (val)));
          XSETCAR (val, make_number (id));
        }
 
index be5d369..2df1577 100644 (file)
@@ -82,7 +82,6 @@ dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \
 # doc.o's dependency on buildobj.h is in src/Makefile.in.
 doc.o: doc.c lisp.h $(config_h) buffer.h keyboard.h keymap.h \
    character.h systime.h coding.h composite.h ../lib/unistd.h globals.h
-doprnt.o: doprnt.c character.h lisp.h globals.h ../lib/unistd.h $(config_h)
 dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
    msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \
    lisp.h $(config_h)
index 158b097..ed0d232 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -154,7 +154,7 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition)
   if (0 > lseek (fd, position - offset, 0))
     {
       emacs_close (fd);
-      error ("Position %ld out of range in doc string file \"%s\"",
+      error ("Position %"pEd" out of range in doc string file \"%s\"",
             position, name);
     }
 
@@ -669,7 +669,7 @@ the same file name is found in the `doc-directory'.  */)
                ; /* Just a source file name boundary marker.  Ignore it.  */
 
              else
-               error ("DOC file invalid at position %d", pos);
+               error ("DOC file invalid at position %"pEd, pos);
            }
        }
       pos += end - buf;
diff --git a/src/doprnt.c b/src/doprnt.c
deleted file mode 100644 (file)
index 36eb272..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-/* Output like sprintf to a buffer of specified size.
-   Also takes args differently: pass one pointer to an array of strings
-   in addition to the format string which is separate.
-   Copyright (C) 1985, 2001-2011  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-
-#include <config.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <setjmp.h>
-
-#ifdef STDC_HEADERS
-#include <float.h>
-#endif
-
-#include <unistd.h>
-
-#include "lisp.h"
-
-/* Since we use the macro CHAR_HEAD_P, we have to include this, but
-   don't have to include others because CHAR_HEAD_P does not contains
-   another macro.  */
-#include "character.h"
-
-#ifndef DBL_MAX_10_EXP
-#define DBL_MAX_10_EXP 308 /* IEEE double */
-#endif
-
-/* Generate output from a format-spec FORMAT,
-   terminated at position FORMAT_END.
-   Output goes in BUFFER, which has room for BUFSIZE chars.
-   If the output does not fit, truncate it to fit.
-   Returns the number of bytes stored into BUFFER.
-   ARGS points to the vector of arguments, and NARGS says how many.
-   A double counts as two arguments.
-   String arguments are passed as C strings.
-   Integers are passed as C integers.  */
-
-EMACS_INT
-doprnt (char *buffer, register int bufsize, const char *format,
-       const char *format_end, va_list ap)
-{
-  const char *fmt = format;    /* Pointer into format string */
-  register char *bufptr = buffer; /* Pointer into output buffer.. */
-
-  /* Use this for sprintf unless we need something really big.  */
-  char tembuf[DBL_MAX_10_EXP + 100];
-
-  /* Size of sprintf_buffer.  */
-  unsigned size_allocated = sizeof (tembuf);
-
-  /* Buffer to use for sprintf.  Either tembuf or same as BIG_BUFFER.  */
-  char *sprintf_buffer = tembuf;
-
-  /* Buffer we have got with malloc.  */
-  char *big_buffer = 0;
-
-  register int tem;
-  char *string;
-  char fixed_buffer[20];       /* Default buffer for small formatting. */
-  char *fmtcpy;
-  int minlen;
-  char charbuf[MAX_MULTIBYTE_LENGTH + 1];      /* Used for %c.  */
-
-  if (format_end == 0)
-    format_end = format + strlen (format);
-
-  if ((format_end - format + 1) < sizeof (fixed_buffer))
-    fmtcpy = fixed_buffer;
-  else
-    fmtcpy = (char *) alloca (format_end - format + 1);
-
-  bufsize--;
-
-  /* Loop until end of format string or buffer full. */
-  while (fmt != format_end && bufsize > 0)
-    {
-      if (*fmt == '%') /* Check for a '%' character */
-       {
-         unsigned size_bound = 0;
-         EMACS_INT width;  /* Columns occupied by STRING.  */
-
-         fmt++;
-         /* Copy this one %-spec into fmtcpy.  */
-         string = fmtcpy;
-         *string++ = '%';
-         while (1)
-           {
-             *string++ = *fmt;
-             if ('0' <= *fmt && *fmt <= '9')
-               {
-                 /* Get an idea of how much space we might need.
-                    This might be a field width or a precision; e.g.
-                    %1.1000f and %1000.1f both might need 1000+ bytes.
-                    Parse the width or precision, checking for overflow.  */
-                 unsigned n = *fmt - '0';
-                 while ('0' <= fmt[1] && fmt[1] <= '9')
-                   {
-                     if (n * 10 + fmt[1] - '0' < n)
-                       error ("Format width or precision too large");
-                     n = n * 10 + fmt[1] - '0';
-                     *string++ = *++fmt;
-                   }
-
-                 if (size_bound < n)
-                   size_bound = n;
-               }
-             else if (*fmt == '-' || *fmt == ' ' || *fmt == '.' || *fmt == '+')
-               ;
-             else
-               break;
-             fmt++;
-           }
-         *string = 0;
-
-         /* Make the size bound large enough to handle floating point formats
-            with large numbers.  */
-         if (size_bound + DBL_MAX_10_EXP + 50 < size_bound)
-           error ("Format width or precision too large");
-         size_bound += DBL_MAX_10_EXP + 50;
-
-         /* Make sure we have that much.  */
-         if (size_bound > size_allocated)
-           {
-             if (big_buffer)
-               big_buffer = (char *) xrealloc (big_buffer, size_bound);
-             else
-               big_buffer = (char *) xmalloc (size_bound);
-             sprintf_buffer = big_buffer;
-             size_allocated = size_bound;
-           }
-         minlen = 0;
-         switch (*fmt++)
-           {
-           default:
-             error ("Invalid format operation %%%c", fmt[-1]);
-
-/*         case 'b': */
-           case 'd':
-           case 'o':
-           case 'x':
-             if (sizeof (int) == sizeof (EMACS_INT))
-               ;
-             else if (sizeof (long) == sizeof (EMACS_INT))
-               /* Insert an `l' the right place.  */
-               string[1] = string[0],
-               string[0] = string[-1],
-               string[-1] = 'l',
-               string++;
-             else
-               abort ();
-             sprintf (sprintf_buffer, fmtcpy, va_arg(ap, char *));
-             /* Now copy into final output, truncating as nec.  */
-             string = sprintf_buffer;
-             goto doit;
-
-           case 'f':
-           case 'e':
-           case 'g':
-             {
-               double d = va_arg(ap, double);
-               sprintf (sprintf_buffer, fmtcpy, d);
-               /* Now copy into final output, truncating as nec.  */
-               string = sprintf_buffer;
-               goto doit;
-             }
-
-           case 'S':
-             string[-1] = 's';
-           case 's':
-             if (fmtcpy[1] != 's')
-               minlen = atoi (&fmtcpy[1]);
-             string = va_arg (ap, char *);
-             tem = strlen (string);
-             width = strwidth (string, tem);
-             goto doit1;
-
-             /* Copy string into final output, truncating if no room.  */
-           doit:
-             /* Coming here means STRING contains ASCII only.  */
-             width = tem = strlen (string);
-           doit1:
-             /* We have already calculated:
-                TEM -- length of STRING,
-                WIDTH -- columns occupied by STRING when displayed, and
-                MINLEN -- minimum columns of the output.  */
-             if (minlen > 0)
-               {
-                 while (minlen > width && bufsize > 0)
-                   {
-                     *bufptr++ = ' ';
-                     bufsize--;
-                     minlen--;
-                   }
-                 minlen = 0;
-               }
-             if (tem > bufsize)
-               {
-                 /* Truncate the string at character boundary.  */
-                 tem = bufsize;
-                 while (!CHAR_HEAD_P (string[tem - 1])) tem--;
-                 memcpy (bufptr, string, tem);
-                 /* We must calculate WIDTH again.  */
-                 width = strwidth (bufptr, tem);
-               }
-             else
-               memcpy (bufptr, string, tem);
-             bufptr += tem;
-             bufsize -= tem;
-             if (minlen < 0)
-               {
-                 while (minlen < - width && bufsize > 0)
-                   {
-                     *bufptr++ = ' ';
-                     bufsize--;
-                     minlen++;
-                   }
-                 minlen = 0;
-               }
-             continue;
-
-           case 'c':
-             {
-               /* Sometimes for %c we pass a char, which would widen
-                  to int.  Sometimes we pass XFASTINT() or XINT()
-                  values, which would be EMACS_INT.  Let's hope that
-                  both are passed the same way, otherwise we'll need
-                  to rewrite callers.  */
-               EMACS_INT chr = va_arg(ap, EMACS_INT);
-               tem = CHAR_STRING ((int) chr, (unsigned char *) charbuf);
-               string = charbuf;
-               string[tem] = 0;
-               width = strwidth (string, tem);
-               if (fmtcpy[1] != 'c')
-                 minlen = atoi (&fmtcpy[1]);
-               goto doit1;
-             }
-
-           case '%':
-             fmt--;    /* Drop thru and this % will be treated as normal */
-           }
-       }
-
-      {
-       /* Just some character; Copy it if the whole multi-byte form
-          fit in the buffer.  */
-       char *save_bufptr = bufptr;
-
-       do { *bufptr++ = *fmt++; }
-       while (--bufsize > 0 && !CHAR_HEAD_P (*fmt));
-       if (!CHAR_HEAD_P (*fmt))
-         {
-           bufptr = save_bufptr;
-           break;
-         }
-      }
-    };
-
-  /* If we had to malloc something, free it.  */
-  xfree (big_buffer);
-
-  *bufptr = 0;         /* Make sure our string end with a '\0' */
-  return bufptr - buffer;
-}
index 93da779..0f9e012 100644 (file)
@@ -18,6 +18,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 #include <config.h>
+#include <limits.h>
 #include <setjmp.h>
 #include "lisp.h"
 #include "blockinput.h"
@@ -30,6 +31,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "xterm.h"
 #endif
 
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+
 /* This definition is duplicated in alloc.c and keyboard.c.  */
 /* Putting it in lisp.h makes cc bomb out!  */
 
@@ -1401,7 +1406,7 @@ internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform,
             || (CONSP (tem)
                 && (SYMBOLP (XCAR (tem))
                     || CONSP (XCAR (tem))))))
-       error ("Invalid condition handler", tem);
+       error ("Invalid condition handler");
     }
 
   c.tag = Qnil;
@@ -1976,33 +1981,39 @@ find_handler_clause (Lisp_Object handlers, Lisp_Object conditions,
 void
 verror (const char *m, va_list ap)
 {
-  char buf[200];
-  EMACS_INT size = 200;
-  int mlen;
+  char buf[4000];
+  size_t size = sizeof buf;
+  size_t size_max =
+    min (MOST_POSITIVE_FIXNUM, min (INT_MAX, SIZE_MAX - 1)) + 1;
   char *buffer = buf;
-  int allocated = 0;
+  int used;
   Lisp_Object string;
 
-  mlen = strlen (m);
-
   while (1)
     {
-      EMACS_INT used;
-      used = doprnt (buffer, size, m, m + mlen, ap);
-      if (used < size)
-       break;
-      size *= 2;
-      if (allocated)
-       buffer = (char *) xrealloc (buffer, size);
-      else
+      used = vsnprintf (buffer, size, m, ap);
+
+      if (used < 0)
        {
-         buffer = (char *) xmalloc (size);
-         allocated = 1;
+         /* Non-C99 vsnprintf, such as w32, returns -1 when SIZE is too small.
+            Guess a larger USED to work around the incompatibility.  */
+         used = (size <= size_max / 2 ? 2 * size
+                 : size < size_max ? size_max - 1
+                 : size_max);
        }
+      else if (used < size)
+       break;
+      if (size_max <= used)
+       memory_full ();
+      size = used + 1;
+
+      if (buffer != buf)
+       xfree (buffer);
+      buffer = (char *) xmalloc (size);
     }
 
-  string = build_string (buffer);
-  if (allocated)
+  string = make_string (buffer, used);
+  if (buffer != buf)
     xfree (buffer);
 
   xsignal1 (Qerror, string);
index c45d9e3..09ce8c1 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -1076,7 +1076,7 @@ an error is signaled.  */)
       EMACS_INT converted = str_to_unibyte (SDATA (string), str, chars, 0);
 
       if (converted < chars)
-       error ("Can't convert the %dth character to unibyte", converted);
+       error ("Can't convert the %"pEd"th character to unibyte", converted);
       string = make_unibyte_string ((char *) str, chars);
       xfree (str);
     }
index 729e681..952f826 100644 (file)
@@ -777,7 +777,7 @@ update_interval (register INTERVAL i, EMACS_INT pos)
              i = i->right;             /* Move to the right child */
            }
          else if (NULL_PARENT (i))
-           error ("Point %d after end of properties", pos);
+           error ("Point %"pEd" after end of properties", pos);
          else
             i = INTERVAL_PARENT (i);
          continue;
index 5a30312..e9992ce 100644 (file)
@@ -8777,7 +8777,8 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt,
         (To ignore it safely, we would need to gcpro a bunch of
         other variables.)  */
       if (! (VECTORP (next) || STRINGP (next)))
-       error ("Function %s returns invalid key sequence", tem);
+       error ("Function %s returns invalid key sequence",
+              SSDATA (SYMBOL_NAME (tem)));
     }
   return next;
 }
index e538b5d..4859862 100644 (file)
@@ -38,6 +38,7 @@ extern void check_cons_list (void);
 #ifndef EMACS_INT
 #define EMACS_INT long
 #define BITS_PER_EMACS_INT BITS_PER_LONG
+#define pEd "ld"
 #endif
 #ifndef EMACS_UINT
 #define EMACS_UINT unsigned long
@@ -46,6 +47,7 @@ extern void check_cons_list (void);
 #ifndef EMACS_INT
 #define EMACS_INT int
 #define BITS_PER_EMACS_INT BITS_PER_INT
+#define pEd "d"
 #endif
 #ifndef EMACS_UINT
 #define EMACS_UINT unsigned int
@@ -2628,7 +2630,6 @@ extern Lisp_Object current_message (void);
 extern void set_message (const char *s, Lisp_Object, EMACS_INT, int);
 extern void clear_message (int, int);
 extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
-extern void message_nolog (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
 extern void message1 (const char *);
 extern void message1_nolog (const char *);
 extern void message2 (const char *, EMACS_INT, int);
@@ -2781,9 +2782,7 @@ extern Lisp_Object internal_with_output_to_temp_buffer
 extern void float_to_string (char *, double);
 extern void syms_of_print (void);
 
-/* Defined in doprnt.c */
-extern EMACS_INT doprnt (char *, int, const char *, const char *, va_list);
-
+/* Defined in lread.c.  */
 extern Lisp_Object Qvariable_documentation, Qstandard_input;
 extern Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction;
 extern Lisp_Object initial_obarray;
@@ -2873,8 +2872,9 @@ extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (size_t, Lisp_Obje
 extern void specbind (Lisp_Object, Lisp_Object);
 extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
 extern Lisp_Object unbind_to (int, Lisp_Object);
-extern void error (const char *, ...) NO_RETURN;
-extern void verror (const char *, va_list) NO_RETURN;
+extern void error (const char *, ...) NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 2);
+extern void verror (const char *, va_list)
+  NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0);
 extern void do_autoload (Lisp_Object, Lisp_Object);
 extern Lisp_Object un_autoload (Lisp_Object);
 EXFUN (Ffetch_bytecode, 1);
index 441f41b..dbca9b5 100644 (file)
@@ -28,6 +28,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Define the type to use.  */
 #define EMACS_INT               long
+#define pEd                    "ld"
 #define EMACS_UINT              unsigned long
 
 /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
index 101d56e..a1374d7 100644 (file)
@@ -28,6 +28,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Define the type to use.  */
 #define EMACS_INT              long
+#define pEd                    "ld"
 #define EMACS_UINT             unsigned long
 
 #ifdef REL_ALLOC
index d4ef5c2..14228b6 100644 (file)
@@ -24,6 +24,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Define the type to use.  */
 #define EMACS_INT long
+#define pEd "ld"
 #define EMACS_UINT unsigned long
 
 /* On the 64 bit architecture, we can use 60 bits for addresses */
@@ -31,4 +32,3 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
 #define XPNTR(a) XUINT (a)
-
index 6a5adbd..d4445d1 100644 (file)
@@ -483,7 +483,7 @@ ns_set_name_internal (FRAME_PTR f, Lisp_Object name)
   if (!STRINGP (f->icon_name))
     encoded_icon_name = encoded_name;
   else
-    encoded_icon_name = ENCODE_UTF_8 (f->icon_name);    
+    encoded_icon_name = ENCODE_UTF_8 (f->icon_name);
 
   str = [NSString stringWithUTF8String: SDATA (encoded_icon_name)];
 
@@ -637,7 +637,7 @@ ns_set_name_as_filename (struct frame *f)
 
   if (FRAME_ICONIFIED_P (f))
     [[view window] setMiniwindowTitle: str];
-  else 
+  else
     {
       NSString *fstr;
 
@@ -1021,8 +1021,8 @@ frame_parm_handler ns_frame_parm_handlers[] =
   0,  /* x_set_fullscreen will ignore */
   x_set_font_backend, /* generic OK */
   x_set_alpha,
-  0, /* x_set_sticky */  
-  0, /* x_set_tool_bar_position */  
+  0, /* x_set_sticky */
+  0, /* x_set_tool_bar_position */
 };
 
 
@@ -2044,7 +2044,7 @@ In case the execution fails, an error is signaled. */)
      (Lisp_Object script)
 {
   Lisp_Object result;
-  long status;
+  int status;
 
   CHECK_STRING (script);
   check_ns ();
@@ -2330,7 +2330,7 @@ If omitted or nil, that stands for the selected frame's display.  */)
 {
   struct ns_display_info *dpyinfo;
   check_ns ();
-  
+
   dpyinfo = check_ns_display_info (display);
   /* We force 24+ bit depths to 24-bit to prevent an overflow.  */
   return make_number (1 << min (dpyinfo->n_planes, 24));
@@ -2373,7 +2373,7 @@ compute_tip_xy (struct frame *f,
       pt.y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - XINT (top)
         - height;
     }
-  
+
   /* Ensure in bounds.  (Note, screen origin = lower left.) */
   if (INTEGERP (left))
     *root_x = pt.x;
@@ -2655,4 +2655,3 @@ be used as the image of the icon representing the frame.  */);
   check_window_system_func = check_ns;
 
 }
-
index a165a9c..f4f767d 100644 (file)
@@ -2361,7 +2361,8 @@ serial_configure (struct Lisp_Process *p,
   CHECK_NUMBER (tem);
   err = cfsetspeed (&attr, XINT (tem));
   if (err != 0)
-    error ("cfsetspeed(%d) failed: %s", XINT (tem), emacs_strerror (errno));
+    error ("cfsetspeed(%"pEd") failed: %s", XINT (tem),
+          emacs_strerror (errno));
   childp2 = Fplist_put (childp2, QCspeed, tem);
 
   /* Configure bytesize.  */
index 9be9950..ea85654 100644 (file)
@@ -86,7 +86,7 @@ static void dissociate_if_controlling_tty (int fd);
 static void delete_tty (struct terminal *);
 static void maybe_fatal (int must_succeed, struct terminal *terminal,
                         const char *str1, const char *str2, ...)
-  NO_RETURN ATTRIBUTE_FORMAT_PRINTF (4, 5);
+  NO_RETURN ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5);
 static void vfatal (const char *str, va_list ap)
   NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0);
 
index d023f9a..a8a6fce 100644 (file)
@@ -3801,7 +3801,7 @@ See Info node `(elisp)Splitting Windows' for more details and examples.  */)
        error ("Window height %d too small (after splitting)", size_int);
       if (size_int + window_safe_height > XFASTINT (o->total_lines))
        error ("Window height %d too small (after splitting)",
-              XFASTINT (o->total_lines) - size_int);
+              (int) (XFASTINT (o->total_lines) - size_int));
       if (NILP (o->parent)
          || NILP (XWINDOW (o->parent)->vchild))
        {
@@ -3818,7 +3818,7 @@ See Info node `(elisp)Splitting Windows' for more details and examples.  */)
        error ("Window width %d too small (after splitting)", size_int);
       if (size_int + window_safe_width > XFASTINT (o->total_cols))
        error ("Window width %d too small (after splitting)",
-              XFASTINT (o->total_cols) - size_int);
+              (int) (XFASTINT (o->total_cols) - size_int));
       if (NILP (o->parent)
          || NILP (XWINDOW (o->parent)->hchild))
        {
index 827ff6d..b1209b9 100644 (file)
@@ -8408,10 +8408,18 @@ vmessage (const char *m, va_list ap)
        {
          if (m)
            {
-             EMACS_INT len;
-
-             len = doprnt (FRAME_MESSAGE_BUF (f),
-                           FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap);
+             char *buf = FRAME_MESSAGE_BUF (f);
+             size_t bufsize = FRAME_MESSAGE_BUF_SIZE (f);
+             int len = vsnprintf (buf, bufsize, m, ap);
+             if (len < 0)
+               len = 0;
+
+             /* Do any truncation at a character boundary.  */
+             if (0 < bufsize && bufsize <= len)
+               for (len = bufsize - 1;
+                    len && ! CHAR_HEAD_P (buf[len - 1]);
+                    len--)
+                 continue;
 
              message2 (FRAME_MESSAGE_BUF (f), len, 0);
            }
@@ -8435,22 +8443,6 @@ message (const char *m, ...)
 }
 
 
-/* The non-logging version of message.  */
-
-void
-message_nolog (const char *m, ...)
-{
-  Lisp_Object old_log_max;
-  va_list ap;
-  va_start (ap, m);
-  old_log_max = Vmessage_log_max;
-  Vmessage_log_max = Qnil;
-  vmessage (m, ap);
-  Vmessage_log_max = old_log_max;
-  va_end (ap);
-}
-
-
 /* Display the current message in the current mini-buffer.  This is
    only called from error handlers in process.c, and is not time
    critical.  */
index 8e56396..04b8e44 100644 (file)
@@ -215,7 +215,7 @@ check_x_display_info (Lisp_Object object)
       struct terminal *t = get_terminal (object, 1);
 
       if (t->type != output_x_window)
-        error ("Terminal %d is not an X display", XINT (object));
+        error ("Terminal %"pEd" is not an X display", XINT (object));
 
       dpyinfo = t->display_info.x;
     }
index d1ff5b8..b3e33b7 100644 (file)
@@ -7539,8 +7539,6 @@ x_error_catcher (Display *display, XErrorEvent *event)
 
    Calling x_uncatch_errors resumes the normal error handling.  */
 
-void x_check_errors (Display *dpy, const char *format);
-
 void
 x_catch_errors (Display *dpy)
 {