changeset 65764:375ab086d366

* image.c (slurp_file, xbm_read_bitmap_data): Cast to the correct type. * xterm.c (handle_one_xevent, handle_one_xevent): Likewise. * unexelf.c (fatal): Fix prototype. * term.c (fatal): Implement using varargs. * regex.c (re_char): Move typedef ... * regex.h (re_char): ... here. (re_iswctype, re_wctype, re_set_whitespace_regexp): New prototypes. * emacs.c (malloc_set_state): Fix return type. (endif): Fix type. * lisp.h (fatal): Add argument types. * dispextern.h (fatal): Delete prototype. * systime.h: (make_time): Prototype moved from ... * editfns.c (make_time): ... here. * editfns.c: Move systime.h include after lisp.h. * dired.c: * xsmfns.c: * process.c: Likewise. * alloc.c (old_malloc_hook, old_realloc_hook, old_realloc_hook): Add parameter types. (__malloc_hook, __realloc_hook, __free_hook): Fix prototypes. (emacs_blocked_free): Change definition to match __free_hook. (emacs_blocked_malloc): Change definition to match __malloc_hook. (emacs_blocked_realloc): Change definition to match __realloc_hook.
author Dan Nicolaescu <dann@ics.uci.edu>
date Fri, 30 Sep 2005 22:38:16 +0000
parents 1a50ac5aaa75
children 444ba3362b80
files src/ChangeLog src/alloc.c src/dired.c src/dispextern.h src/emacs.c src/image.c src/lisp.h src/process.c src/regex.c src/regex.h src/systime.h src/term.c src/unexelf.c src/xsmfns.c src/xterm.c
diffstat 15 files changed, 83 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/ChangeLog	Fri Sep 30 22:38:16 2005 +0000
@@ -1,3 +1,41 @@
+2005-09-30  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* image.c (slurp_file, xbm_read_bitmap_data): Cast to the correct
+	type.
+	* xterm.c (handle_one_xevent, handle_one_xevent): Likewise.
+
+	* unexelf.c (fatal): Fix prototype.
+
+	* term.c (fatal): Implement using varargs.
+
+	* regex.c (re_char): Move typedef ... 
+	* regex.h (re_char): ... here.
+	(re_iswctype, re_wctype, re_set_whitespace_regexp): New
+	prototypes.
+
+	* emacs.c (malloc_set_state): Fix return type.
+	(endif): Fix type.
+
+	* lisp.h (fatal): Add argument types.
+
+	* dispextern.h (fatal): Delete prototype.
+
+	* systime.h: (make_time): Prototype moved from ...
+	* editfns.c (make_time): ... here.
+
+	* editfns.c: Move systime.h include after lisp.h.
+	* dired.c: 
+	* xsmfns.c: 
+	* process.c: Likewise.
+	
+	* alloc.c (old_malloc_hook, old_realloc_hook, old_realloc_hook):
+	Add parameter types.
+	(__malloc_hook, __realloc_hook, __free_hook): Fix prototypes.
+	(emacs_blocked_free): Change definition to match __free_hook.
+	(emacs_blocked_malloc): Change definition to match __malloc_hook.
+	(emacs_blocked_realloc): Change definition to match
+	__realloc_hook.
+
 2005-09-30  Romain Francoise  <romain@orebokech.com>
 
 	* minibuf.c (Fread_buffer): Follow convention for reading from the
--- a/src/alloc.c	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/alloc.c	Fri Sep 30 22:38:16 2005 +0000
@@ -1161,20 +1161,21 @@
 #ifndef SYNC_INPUT
 
 #ifndef DOUG_LEA_MALLOC
-extern void * (*__malloc_hook) P_ ((size_t));
-extern void * (*__realloc_hook) P_ ((void *, size_t));
-extern void (*__free_hook) P_ ((void *));
+extern void * (*__malloc_hook) P_ ((size_t, const void *));
+extern void * (*__realloc_hook) P_ ((void *, size_t, const void *));
+extern void (*__free_hook) P_ ((void *, const void *));
 /* Else declared in malloc.h, perhaps with an extra arg.  */
 #endif /* DOUG_LEA_MALLOC */
-static void * (*old_malloc_hook) ();
-static void * (*old_realloc_hook) ();
-static void (*old_free_hook) ();
+static void * (*old_malloc_hook) P_ ((size_t, const void *));
+static void * (*old_realloc_hook) P_ ((void *,  size_t, const void*));
+static void (*old_free_hook) P_ ((void*, const void*));
 
 /* This function is used as the hook for free to call.  */
 
 static void
-emacs_blocked_free (ptr)
+emacs_blocked_free (ptr, ptr2)
      void *ptr;
+     const void *ptr2;
 {
   BLOCK_INPUT_ALLOC;
 
@@ -1221,8 +1222,9 @@
 /* This function is the malloc hook that Emacs uses.  */
 
 static void *
-emacs_blocked_malloc (size)
+emacs_blocked_malloc (size, ptr)
      size_t size;
+     const void *ptr;
 {
   void *value;
 
@@ -1268,9 +1270,10 @@
 /* This function is the realloc hook that Emacs uses.  */
 
 static void *
-emacs_blocked_realloc (ptr, size)
+emacs_blocked_realloc (ptr, size, ptr2)
      void *ptr;
      size_t size;
+     const void *ptr2;
 {
   void *value;
 
--- a/src/dired.c	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/dired.c	Fri Sep 30 22:38:16 2005 +0000
@@ -33,7 +33,6 @@
 #include <grp.h>
 #endif
 
-#include "systime.h"
 #include <errno.h>
 
 #ifdef VMS
@@ -93,6 +92,7 @@
 #endif
 
 #include "lisp.h"
+#include "systime.h"
 #include "buffer.h"
 #include "commands.h"
 #include "charset.h"
--- a/src/dispextern.h	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/dispextern.h	Fri Sep 30 22:38:16 2005 +0000
@@ -2940,7 +2940,6 @@
 extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object));
 extern void tty_setup_colors P_ ((int));
 extern void term_init P_ ((char *));
-extern void fatal P_ ((/* char *, ... */));
 void cursor_to P_ ((int, int));
 extern int tty_capable_p P_ ((struct frame *, unsigned, unsigned long, unsigned long));
 
--- a/src/emacs.c	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/emacs.c	Fri Sep 30 22:38:16 2005 +0000
@@ -148,7 +148,7 @@
 /* From glibc, a routine that returns a copy of the malloc internal state.  */
 extern void *malloc_get_state ();
 /* From glibc, a routine that overwrites the malloc internal state.  */
-extern void malloc_set_state ();
+extern int malloc_set_state ();
 /* Non-zero if the MALLOC_CHECK_ enviroment variable was set while
    dumping.  Used to work around a bug in glibc's malloc.  */
 int malloc_using_checking;
@@ -1001,7 +1001,7 @@
       && !getrlimit (RLIMIT_STACK, &rlim))
     {
       long newlim;
-      extern int re_max_failures;
+      extern size_t re_max_failures;
       /* Approximate the amount regex.c needs per unit of re_max_failures.  */
       int ratio = 20 * sizeof (char *);
       /* Then add 33% to cover the size of the smaller stacks that regex.c
--- a/src/image.c	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/image.c	Fri Sep 30 22:38:16 2005 +0000
@@ -2178,7 +2178,7 @@
 
   if (stat (file, &st) == 0
       && (fp = fopen (file, "rb")) != NULL
-      && (buf = (char *) xmalloc (st.st_size),
+      && (buf = (unsigned char *) xmalloc (st.st_size),
 	  fread (buf, 1, st.st_size, fp) == st.st_size))
     {
       *size = st.st_size;
@@ -3029,7 +3029,7 @@
 
   bytes_per_line = (*width + 7) / 8 + padding_p;
   nbytes = bytes_per_line * *height;
-  p = *data = (char *) xmalloc (nbytes);
+  p = *data = (unsigned char *) xmalloc (nbytes);
 
   if (v10)
     {
--- a/src/lisp.h	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/lisp.h	Fri Sep 30 22:38:16 2005 +0000
@@ -3158,7 +3158,7 @@
 
 /* Defined in term.c */
 extern void syms_of_term P_ ((void));
-extern void fatal () NO_RETURN;
+extern void fatal P_ ((const char *msgid, ...)) NO_RETURN;
 
 #ifdef HAVE_X_WINDOWS
 /* Defined in fontset.c */
--- a/src/process.c	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/process.c	Fri Sep 30 22:38:16 2005 +0000
@@ -118,10 +118,10 @@
 #include <sys/wait.h>
 #endif
 
+#include "lisp.h"
 #include "systime.h"
 #include "systty.h"
 
-#include "lisp.h"
 #include "window.h"
 #include "buffer.h"
 #include "charset.h"
--- a/src/regex.c	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/regex.c	Fri Sep 30 22:38:16 2005 +0000
@@ -524,9 +524,6 @@
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 
-/* Type of source-pattern and string chars.  */
-typedef const unsigned char re_char;
-
 typedef char boolean;
 #define false 0
 #define true 1
--- a/src/regex.h	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/regex.h	Fri Sep 30 22:38:16 2005 +0000
@@ -603,8 +603,16 @@
 	       RECC_ASCII, RECC_UNIBYTE
 } re_wctype_t;
 
+extern char re_iswctype (int ch,    re_wctype_t cc);
+extern re_wctype_t re_wctype (const unsigned char* str);
+
 typedef int re_wchar_t;
 
+/* Type of source-pattern and string chars.  */
+typedef const unsigned char re_char;
+
+extern void re_set_whitespace_regexp (re_char *regexp);
+
 #endif /* not WIDE_CHAR_SUPPORT */
 
 #endif /* regex.h */
--- a/src/systime.h	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/systime.h	Fri Sep 30 22:38:16 2005 +0000
@@ -157,6 +157,14 @@
 /* defined in keyboard.c */
 extern void set_waiting_for_input __P ((EMACS_TIME *));
 
+/* When lisp.h is not included Lisp_Object is not defined (this can
+   happen when this files is used outside the src directory).
+   Use GCPRO1 to determine if lisp.h was included.  */
+#ifdef GCPRO1
+/* defined in dired.c */
+extern Lisp_Object make_time __P ((time_t));
+#endif
+
 /* Compare times T1 and T2.  Value is 0 if T1 and T2 are the same.
    Value is < 0 if T1 is less than T2.  Value is > 0 otherwise.  */
 
--- a/src/term.c	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/term.c	Fri Sep 30 22:38:16 2005 +0000
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>
+#include <stdarg.h>
 
 #include "termchar.h"
 #include "termopts.h"
@@ -2689,12 +2690,13 @@
 
 /* VARARGS 1 */
 void
-fatal (str, arg1, arg2)
-     char *str, *arg1, *arg2;
+fatal (const char *str, ...)
 {
+  va_list ap;
+  va_start (ap, str);
   fprintf (stderr, "emacs: ");
-  fprintf (stderr, str, arg1, arg2);
-  fprintf (stderr, "\n");
+  vfprintf (stderr, str, ap);
+  va_end (ap);
   fflush (stderr);
   exit (1);
 }
--- a/src/unexelf.c	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/unexelf.c	Fri Sep 30 22:38:16 2005 +0000
@@ -412,7 +412,7 @@
 #include <string.h>
 #else
 #include <config.h>
-extern void fatal (char *, ...);
+extern void fatal (const char *msgid, ...);
 #endif
 
 #include <sys/types.h>
--- a/src/xsmfns.c	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/xsmfns.c	Fri Sep 30 22:38:16 2005 +0000
@@ -45,9 +45,9 @@
 #include <sys/param.h>
 #include <stdio.h>
 
+#include "lisp.h"
 #include "systime.h"
 #include "sysselect.h"
-#include "lisp.h"
 #include "termhooks.h"
 #include "termopts.h"
 #include "xterm.h"
--- a/src/xterm.c	Fri Sep 30 22:38:16 2005 +0000
+++ b/src/xterm.c	Fri Sep 30 22:38:16 2005 +0000
@@ -6231,7 +6231,7 @@
               if (status_return == XBufferOverflow)
                 {
                   copy_bufsiz = nbytes + 1;
-                  copy_bufptr = (char *) alloca (copy_bufsiz);
+                  copy_bufptr = (unsigned char *) alloca (copy_bufsiz);
                   nbytes = XmbLookupString (FRAME_XIC (f),
                                             &event.xkey, copy_bufptr,
                                             copy_bufsiz, &keysym,
@@ -6249,7 +6249,7 @@
                   if (status_return == XBufferOverflow)
                     {
                       copy_bufsiz = nbytes + 1;
-                      copy_bufptr = (char *) alloca (copy_bufsiz);
+                      copy_bufptr = (unsigned char *) alloca (copy_bufsiz);
                       nbytes = Xutf8LookupString (FRAME_XIC (f),
                                                   &event.xkey,
                                                   copy_bufptr,