changeset 109555:05e7e7c46ff0

Use const, move declarations to header files. * src/buffer.c (Fset_buffer_multibyte): Remove local extern declaration. * src/character.c (strwidth, parse_str_to_multibyte): Add const. * src/character.h (strwidth, parse_str_to_multibyte): Likewise. * src/charset.c (add_to_log): Remove declaration. * src/composite.c (syms_of_composite): Remove local extern declarations. * src/data.c (Finteractive_form): Use const. * src/dired.c (scmp): Add const. (directory_files_internal): Remove local extern declaration. * src/dispextern.h (add_to_log): Remove declaration. (x_get_arg, x_frame_get_arg, x_frame_get_and_record_arg) (x_frame_get_and_record_arg, x_default_parameter): Add const. * src/dispnew.c: Remove duplicate #include <unistd.h>. (update_window, update_frame_1, init_display): Remove local extern declarations. * src/editfns.c (region_limit, syms_of_editfns): Remove local extern declarations. * src/emacs.c (main): Remove local extern declaration. * src/font.c (Qnormal, QCtype, QCfamily, QCweight, QCslant, QCwidth) (QCheight, QCsize, QCname): Remove declarations. * src/frame.c (x_get_resource_string, x_get_string_resource) (x_get_arg, x_frame_get_arg, x_frame_get_and_record_arg) (x_default_parameter): Use const. * src/image.c (QCwidth, QCheight, QCforeground, QCbackground, QCfile) (QCdata, QCtype, Qcenter): Remove declarations. * src/keyboard.h (do_mouse_tracking): Add declaration. * src/minibuf.c (Qmouse_face): Remove declaration. * src/msdos.c (IT_note_mouse_highlight): Remove local extern declaration. * src/xdisp.c (do_mouse_tracking): Remove declaration. (add_to_log): Use const. * src/xfaces.c (Qmouse_face): Remove declaration. (face_color_gray_p, tty_defined_color, defined_color) (face_color_gray_p, face_color_supported_p). Add const. * src/xfns.c: Include xlwmenu.h when USE_LUCID. (x_defined_color, xic_set_xfontset): Use const. (Fx_hide_tip): Remove local extern declaration. * src/xselect.c (selection_data_to_lisp_data) (x_property_data_to_lisp): * src/xrdb.c (x_get_string_resource, file_p) (x_get_customization_string, magic_file_p, search_magic_path) (get_system_app, get_user_app, x_load_resources, x_get_resource) (x_get_string_resource): Use const. * src/xterm.c (xlwmenu_window_p, xlwmenu_redisplay): Remove declarations. (x_text_icon, x_check_errors, x_connection_closed): Use const. * src/xterm.h (x_get_customization_string, x_load_resources) (x_get_resource, x_text_icon, x_text_icon, x_check_errors) (x_check_errors, x_property_data_to_lisp, defined_color) (xic_set_xfontset, x_defined_color): Use const.
author Dan Nicolaescu <dann@ics.uci.edu>
date Mon, 26 Jul 2010 20:52:35 -0700
parents b22b609d1fa7
children 039143f82441
files src/buffer.c src/character.c src/character.h src/charset.c src/composite.c src/data.c src/dired.c src/dispextern.h src/dispnew.c src/editfns.c src/emacs.c src/font.c src/frame.c src/image.c src/keyboard.h src/minibuf.c src/msdos.c src/xdisp.c src/xfaces.c src/xfns.c src/xrdb.c src/xselect.c src/xterm.c src/xterm.h
diffstat 24 files changed, 89 insertions(+), 106 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/buffer.c	Mon Jul 26 20:52:35 2010 -0700
@@ -2512,7 +2512,6 @@
   if (!EQ (old_undo, Qt))
     {
       /* Represent all the above changes by a special undo entry.  */
-      extern Lisp_Object Qapply;
       current_buffer->undo_list = Fcons (list3 (Qapply,
 						intern ("set-buffer-multibyte"),
 						NILP (flag) ? Qt : Qnil),
--- a/src/character.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/character.c	Mon Jul 26 20:52:35 2010 -0700
@@ -430,7 +430,7 @@
    occupies on the screen.  */
 
 int
-strwidth (unsigned char *str, int len)
+strwidth (const unsigned char *str, int len)
 {
   return c_string_width (str, len, -1, NULL, NULL);
 }
@@ -710,9 +710,9 @@
    `str_to_multibyte'.  */
 
 int
-parse_str_to_multibyte (unsigned char *str, int len)
+parse_str_to_multibyte (const unsigned char *str, int len)
 {
-  unsigned char *endp = str + len;
+  const unsigned char *endp = str + len;
   int bytes;
 
   for (bytes = 0; str < endp; str++)
--- a/src/character.h	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/character.h	Mon Jul 26 20:52:35 2010 -0700
@@ -605,13 +605,13 @@
 extern int char_printable_p (int c);
 extern void parse_str_as_multibyte (const unsigned char *, int, int *,
                                     int *);
-extern int parse_str_to_multibyte (unsigned char *, int);
+extern int parse_str_to_multibyte (const unsigned char *, int);
 extern int str_as_multibyte (unsigned char *, int, int, int *);
 extern int str_to_multibyte (unsigned char *, int, int);
 extern int str_as_unibyte (unsigned char *, int);
 extern EMACS_INT str_to_unibyte (const unsigned char *, unsigned char *,
                                  EMACS_INT, int);
-extern int strwidth (unsigned char *, int);
+extern int strwidth (const unsigned char *, int);
 extern int c_string_width (const unsigned char *, int, int, int *, int *);
 extern int lisp_string_width (Lisp_Object, int, int *, int *);
 
--- a/src/charset.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/charset.c	Mon Jul 26 20:52:35 2010 -0700
@@ -491,8 +491,6 @@
    Note that this function uses `openp' to open MAPFILE but ignores
    `file-name-handler-alist' to avoid running any Lisp code.  */
 
-extern void add_to_log (char *, Lisp_Object, Lisp_Object);
-
 static void
 load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int control_flag)
 {
--- a/src/composite.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/composite.c	Mon Jul 26 20:52:35 2010 -0700
@@ -1939,7 +1939,6 @@
   /* Make a hash table for static composition.  */
   {
     Lisp_Object args[6];
-    extern Lisp_Object QCsize;
 
     args[0] = QCtest;
     args[1] = Qequal;
@@ -1959,8 +1958,6 @@
   /* Make a hash table for glyph-string.  */
   {
     Lisp_Object args[6];
-    extern Lisp_Object QCsize;
-
     args[0] = QCtest;
     args[1] = Qequal;
     args[2] = QCweakness;
--- a/src/data.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/data.c	Mon Jul 26 20:52:35 2010 -0700
@@ -750,7 +750,7 @@
 
   if (SUBRP (fun))
     {
-      char *spec = XSUBR (fun)->intspec;
+      const char *spec = XSUBR (fun)->intspec;
       if (spec)
 	return list2 (Qinteractive,
 		      (*spec != '(') ? build_string (spec) :
--- a/src/dired.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/dired.c	Mon Jul 26 20:52:35 2010 -0700
@@ -115,7 +115,7 @@
 Lisp_Object Qfile_attributes;
 Lisp_Object Qfile_attributes_lessp;
 
-static int scmp (unsigned char *, unsigned char *, int);
+static int scmp (const unsigned char *, const unsigned char *, int);
 
 #ifdef WINDOWSNT
 Lisp_Object
@@ -206,7 +206,6 @@
 #ifdef WINDOWSNT
   if (attrs)
     {
-      extern Lisp_Object Qlocal;
       extern int is_slow_fs (const char *);
 
       /* Do this only once to avoid doing it (in w32.c:stat) for each
@@ -813,7 +812,7 @@
    else number of chars that match at the beginning.  */
 
 static int
-scmp (register unsigned char *s1, register unsigned char *s2, int len)
+scmp (const unsigned char *s1, const unsigned char *s2, int len)
 {
   register int l = len;
 
--- a/src/dispextern.h	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/dispextern.h	Mon Jul 26 20:52:35 2010 -0700
@@ -2951,7 +2951,6 @@
 extern Lisp_Object Vshow_trailing_whitespace;
 extern int mode_line_in_non_selected_windows;
 extern int redisplaying_p;
-extern void add_to_log (char *, Lisp_Object, Lisp_Object);
 extern int help_echo_showing_p;
 extern int current_mode_line_height, current_header_line_height;
 extern Lisp_Object help_echo_string, help_echo_window;
@@ -3322,18 +3321,18 @@
 };
 
 extern Lisp_Object x_get_arg (Display_Info *, Lisp_Object,
-                              Lisp_Object, char *, char *class,
+                              Lisp_Object, const char *, const char *class,
                               enum resource_types);
 extern Lisp_Object x_frame_get_arg (struct frame *, Lisp_Object,
-                                    Lisp_Object, char *, char *,
+                                    Lisp_Object, const char *, const char *,
                                     enum resource_types);
-extern Lisp_Object x_frame_get_and_record_arg (
-                                               struct frame *, Lisp_Object,
-                                               Lisp_Object, char *, char *,
+extern Lisp_Object x_frame_get_and_record_arg (struct frame *, Lisp_Object,
+                                               Lisp_Object,
+					       const char *, const char *,
                                                enum resource_types);
 extern Lisp_Object x_default_parameter (struct frame *, Lisp_Object,
                                         Lisp_Object, Lisp_Object,
-                                        char *, char *,
+                                        const char *, const char *,
                                         enum resource_types);
 
 #endif /* HAVE_WINDOW_SYSTEM */
--- a/src/dispnew.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/dispnew.c	Mon Jul 26 20:52:35 2010 -0700
@@ -66,12 +66,6 @@
 #include "systime.h"
 #include <errno.h>
 
-/* To get the prototype for `sleep'.  */
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
 /* Get number of chars of output now in the buffer of a stdio stream.
    This ought to be built in in stdio, but it isn't.  Some s- files
    override this because their stdio internals differ.  */
@@ -3664,8 +3658,6 @@
 #if !PERIODIC_PREEMPTION_CHECKING
   int preempt_count = baud_rate / 2400 + 1;
 #endif
-  extern int input_pending;
-  extern Lisp_Object do_mouse_tracking;
   struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 #if GLYPH_DEBUG
   /* Check that W's frame doesn't have glyph matrices.  */
@@ -4710,7 +4702,6 @@
   int i;
   int pause;
   int preempt_count = baud_rate / 2400 + 1;
-  extern int input_pending;
 
   xassert (current_matrix && desired_matrix);
 
@@ -6235,10 +6226,6 @@
 {
   char *terminal_type;
 
-#ifdef HAVE_X_WINDOWS
-  extern int display_arg;
-#endif
-
   /* Construct the space glyph.  */
   space_glyph.type = CHAR_GLYPH;
   SET_CHAR_GLYPH (space_glyph, ' ', DEFAULT_FACE_ID, 0);
--- a/src/editfns.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/editfns.c	Mon Jul 26 20:52:35 2010 -0700
@@ -320,7 +320,6 @@
 static Lisp_Object
 region_limit (int beginningp)
 {
-  extern Lisp_Object Vmark_even_if_inactive; /* Defined in callint.c. */
   Lisp_Object m;
 
   if (!NILP (Vtransient_mark_mode)
@@ -4554,7 +4553,6 @@
 
   {
     Lisp_Object obuf;
-    extern Lisp_Object Vprin1_to_string_buffer;
     obuf = Fcurrent_buffer ();
     /* Do this here, because init_buffer_once is too early--it won't work.  */
     Fset_buffer (Vprin1_to_string_buffer);
--- a/src/emacs.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/emacs.c	Mon Jul 26 20:52:35 2010 -0700
@@ -757,7 +757,6 @@
   char *ch_to_dir;
 
 #if GC_MARK_STACK
-  extern Lisp_Object *stack_base;
   stack_base = &dummy;
 #endif
 
--- a/src/font.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/font.c	Mon Jul 26 20:52:35 2010 -0700
@@ -127,12 +127,6 @@
   { 200, { "ultra-expanded", "ultraexpanded", "wide" }}
 };
 
-extern Lisp_Object Qnormal;
-
-/* Symbols representing keys of normal font properties.  */
-extern Lisp_Object QCtype, QCfamily, QCweight, QCslant, QCwidth;
-extern Lisp_Object QCheight, QCsize, QCname;
-
 Lisp_Object QCfoundry, QCadstyle, QCregistry;
 /* Symbols representing keys of font extra info.  */
 Lisp_Object QCspacing, QCdpi, QCscalable, QCotf, QClang, QCscript, QCavgwidth;
--- a/src/frame.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/frame.c	Mon Jul 26 20:52:35 2010 -0700
@@ -3721,7 +3721,7 @@
 }
 
 
-extern char *x_get_string_resource (XrmDatabase, char *, char *);
+extern char *x_get_string_resource (XrmDatabase, const char *, const char *);
 extern Display_Info *check_x_display_info (Lisp_Object);
 
 
@@ -3823,7 +3823,7 @@
 /* Used when C code wants a resource value.  */
 /* Called from oldXMenu/Create.c.  */
 char *
-x_get_resource_string (char *attribute, char *class)
+x_get_resource_string (const char *attribute, const char *class)
 {
   char *name_key;
   char *class_key;
@@ -3856,7 +3856,8 @@
    and don't let it get stored in any Lisp-visible variables!  */
 
 Lisp_Object
-x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type)
+x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param,
+	   const char *attribute, const char *class, enum resource_types type)
 {
   register Lisp_Object tem;
 
@@ -3954,7 +3955,9 @@
 }
 
 Lisp_Object
-x_frame_get_arg (struct frame *f, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type)
+x_frame_get_arg (struct frame *f, Lisp_Object alist, Lisp_Object param,
+		 const char *attribute, const char *class,
+		 enum resource_types type)
 {
   return x_get_arg (FRAME_X_DISPLAY_INFO (f),
 		    alist, param, attribute, class, type);
@@ -3963,7 +3966,10 @@
 /* Like x_frame_get_arg, but also record the value in f->param_alist.  */
 
 Lisp_Object
-x_frame_get_and_record_arg (struct frame *f, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type)
+x_frame_get_and_record_arg (struct frame *f, Lisp_Object alist,
+			    Lisp_Object param,
+			    const char *attribute, const char *class,
+			    enum resource_types type)
 {
   Lisp_Object value;
 
@@ -3983,7 +3989,9 @@
    If that is not found either, use the value DEFLT.  */
 
 Lisp_Object
-x_default_parameter (struct frame *f, Lisp_Object alist, Lisp_Object prop, Lisp_Object deflt, char *xprop, char *xclass, enum resource_types type)
+x_default_parameter (struct frame *f, Lisp_Object alist, Lisp_Object prop,
+		     Lisp_Object deflt, const char *xprop, const char *xclass,
+		     enum resource_types type)
 {
   Lisp_Object tem;
 
--- a/src/image.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/image.c	Mon Jul 26 20:52:35 2010 -0700
@@ -578,9 +578,6 @@
 
 /* Keywords.  */
 
-extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile;
-extern Lisp_Object QCdata, QCtype;
-extern Lisp_Object Qcenter;
 Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data;
 Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
 Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask;
--- a/src/keyboard.h	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/keyboard.h	Mon Jul 26 20:52:35 2010 -0700
@@ -406,6 +406,8 @@
 #define POSN_INBUFFER_P(posn) (NILP (POSN_STRING (posn)))
 #define POSN_BUFFER_POSN(posn) (Fnth (make_number (5), (posn)))
 
+extern Lisp_Object do_mouse_tracking;
+
 /* Some of the event heads.  */
 extern Lisp_Object Qswitch_frame;
 
--- a/src/minibuf.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/minibuf.c	Mon Jul 26 20:52:35 2010 -0700
@@ -145,8 +145,6 @@
 
 extern Lisp_Object Voverriding_local_map;
 
-extern Lisp_Object Qmouse_face;
-
 extern Lisp_Object Qfield;
 
 /* Put minibuf on currently selected frame's minibuffer.
--- a/src/msdos.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/msdos.c	Mon Jul 26 20:52:35 2010 -0700
@@ -1330,7 +1330,6 @@
 
       /* Check for mouse-face and help-echo.  */
       {
-	extern Lisp_Object Qmouse_face;
 	Lisp_Object mouse_face, overlay, position, *overlay_vec;
 	int noverlays, obegv, ozv;
 	struct buffer *obuf;
--- a/src/xdisp.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/xdisp.c	Mon Jul 26 20:52:35 2010 -0700
@@ -276,8 +276,6 @@
 extern int interrupt_input;
 extern int command_loop_level;
 
-extern Lisp_Object do_mouse_tracking;
-
 extern int minibuffer_auto_raise;
 extern Lisp_Object Vminibuffer_list;
 
@@ -7966,7 +7964,7 @@
    to *Messages*.  */
 
 void
-add_to_log (char *format, Lisp_Object arg1, Lisp_Object arg2)
+add_to_log (const char *format, Lisp_Object arg1, Lisp_Object arg2)
 {
   Lisp_Object args[3];
   Lisp_Object msg, fmt;
--- a/src/xfaces.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/xfaces.c	Mon Jul 26 20:52:35 2010 -0700
@@ -411,7 +411,6 @@
 /* The symbols `face' and `mouse-face' used as text properties.  */
 
 Lisp_Object Qface;
-extern Lisp_Object Qmouse_face;
 
 /* Property for basic faces which other faces cannot inherit.  */
 
@@ -520,7 +519,7 @@
 static struct frame *frame_or_selected_frame (Lisp_Object, int);
 static void load_face_colors (struct frame *, struct face *, Lisp_Object *);
 static void free_face_colors (struct frame *, struct face *);
-static int face_color_gray_p (struct frame *, char *);
+static int face_color_gray_p (struct frame *, const char *);
 static struct face *realize_face (struct face_cache *, Lisp_Object *,
                                   int);
 static struct face *realize_non_ascii_face (struct frame *, Lisp_Object,
@@ -1171,7 +1170,8 @@
 /* A version of defined_color for non-X frames.  */
 
 int
-tty_defined_color (struct frame *f, char *color_name, XColor *color_def, int alloc)
+tty_defined_color (struct frame *f, const char *color_name,
+		   XColor *color_def, int alloc)
 {
   int status = 1;
 
@@ -1206,7 +1206,7 @@
    This does the right thing for any type of frame.  */
 
 int
-defined_color (struct frame *f, char *color_name, XColor *color_def, int alloc)
+defined_color (struct frame *f, const char *color_name, XColor *color_def, int alloc)
 {
   if (!FRAME_WINDOW_P (f))
     return tty_defined_color (f, color_name, color_def, alloc);
@@ -1266,7 +1266,7 @@
    The criterion implemented here is not a terribly sophisticated one.  */
 
 static int
-face_color_gray_p (struct frame *f, char *color_name)
+face_color_gray_p (struct frame *f, const char *color_name)
 {
   XColor color;
   int gray_p;
@@ -1293,7 +1293,7 @@
    color.  */
 
 static int
-face_color_supported_p (struct frame *f, char *color_name, int background_p)
+face_color_supported_p (struct frame *f, const char *color_name, int background_p)
 {
   Lisp_Object frame;
   XColor not_used;
--- a/src/xfns.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/xfns.c	Mon Jul 26 20:52:35 2010 -0700
@@ -101,6 +101,10 @@
 #include <Xm/FileSB.h>
 #endif
 
+#ifdef USE_LUCID
+#include "../lwlib/xlwmenu.h"
+#endif
+
 #if !defined(NO_EDITRES)
 #define HACK_EDITRES
 extern void _XEditResCheckMessages ();
@@ -650,7 +654,8 @@
    no color could be allocated.  */
 
 int
-x_defined_color (struct frame *f, char *color_name, XColor *color, int alloc_p)
+x_defined_color (struct frame *f, const char *color_name,
+		 XColor *color, int alloc_p)
 {
   int success_p;
   Display *dpy = FRAME_X_DISPLAY (f);
@@ -2353,7 +2358,7 @@
    BASE_FONTNAME.  Called when a new Emacs fontset is chosen.  */
 
 void
-xic_set_xfontset (struct frame *f, char *base_fontname)
+xic_set_xfontset (struct frame *f, const char *base_fontname)
 {
   XVaNestedList attr;
   XFontSet xfs;
@@ -5205,7 +5210,6 @@
       {
 	struct frame *f = SELECTED_FRAME ();
 	Widget w = f->output_data.x->menubar_widget;
-        extern void xlwmenu_redisplay (Widget);
 
 	if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen)
 	    && w != NULL)
--- a/src/xrdb.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/xrdb.c	Mon Jul 26 20:52:35 2010 -0700
@@ -82,8 +82,9 @@
 #define free xfree
 #endif
 
-char *x_get_string_resource (XrmDatabase rdb, char *name, char *class);
-static int file_p (char *filename);
+char *x_get_string_resource (XrmDatabase rdb, const char *name,
+			     const char *class);
+static int file_p (const char *filename);
 
 
 /* X file search path processing.  */
@@ -98,7 +99,7 @@
    resource, for later use in search path decoding.  If we find no
    such resource, return zero.  */
 char *
-x_get_customization_string (XrmDatabase db, char *name, char *class)
+x_get_customization_string (XrmDatabase db, const char *name, const char *class)
 {
   char *full_name
     = (char *) alloca (strlen (name) + sizeof ("customization") + 3);
@@ -153,7 +154,7 @@
    Return NULL otherwise.  */
 
 static char *
-magic_file_p (char *string, int string_len, char *class, char *escaped_suffix, char *suffix)
+magic_file_p (const char *string, int string_len, const char *class, const char *escaped_suffix, const char *suffix)
 {
   char *lang = getenv ("LANG");
 
@@ -161,12 +162,12 @@
   char *path = (char *) malloc (path_size);
   int path_len = 0;
 
-  char *p = string;
+  const char *p = string;
 
   while (p < string + string_len)
     {
       /* The chunk we're about to stick on the end of result.  */
-      char *next = NULL;
+      const char *next = NULL;
       int next_len;
 
       if (*p == '%')
@@ -306,7 +307,7 @@
 
 
 static int
-file_p (char *filename)
+file_p (const char *filename)
 {
   struct stat status;
 
@@ -321,9 +322,9 @@
    the path name of the one we found otherwise.  */
 
 static char *
-search_magic_path (char *search_path, char *class, char *escaped_suffix, char *suffix)
+search_magic_path (const char *search_path, const char *class, const char *escaped_suffix, const char *suffix)
 {
-  register char *s, *p;
+  const char *s, *p;
 
   for (s = search_path; *s; s = p)
     {
@@ -332,7 +333,8 @@
 
       if (p > s)
 	{
-	  char *path = magic_file_p (s, p - s, class, escaped_suffix, suffix);
+	  char *path = magic_file_p (s, p - s, class, escaped_suffix,
+					   suffix);
 	  if (path)
 	    return path;
 	}
@@ -356,7 +358,7 @@
 /* Producing databases for individual sources.  */
 
 static XrmDatabase
-get_system_app (char *class)
+get_system_app (const char *class)
 {
   XrmDatabase db = NULL;
   char *path;
@@ -383,7 +385,7 @@
 
 
 static XrmDatabase
-get_user_app (char *class)
+get_user_app (const char *class)
 {
   char *path;
   char *file = 0;
@@ -494,17 +496,18 @@
 /* Load X resources based on the display and a possible -xrm option. */
 
 XrmDatabase
-x_load_resources (Display *display, char *xrm_string, char *myname, char *myclass)
+x_load_resources (Display *display, const char *xrm_string,
+		  const char *myname, const char *myclass)
 {
   XrmDatabase user_database;
   XrmDatabase rdb;
   XrmDatabase db;
   char line[256];
 
-  char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1";
+  const char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1";
 
 #ifdef USE_MOTIF
-  char *courier = "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1";
+  const char *courier = "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1";
   extern Lisp_Object Vdouble_click_time;
 #endif
 
@@ -628,7 +631,7 @@
    and of type TYPE from database RDB.  The value is returned in RET_VALUE. */
 
 int
-x_get_resource (XrmDatabase rdb, char *name, char *class, XrmRepresentation expected_type, XrmValue *ret_value)
+x_get_resource (XrmDatabase rdb, const char *name, const char *class, XrmRepresentation expected_type, XrmValue *ret_value)
 {
   XrmValue value;
   XrmName namelist[100];
@@ -656,7 +659,7 @@
    database RDB. */
 
 char *
-x_get_string_resource (XrmDatabase rdb, char *name, char *class)
+x_get_string_resource (XrmDatabase rdb, const char *name, const char *class)
 {
   XrmValue value;
 
--- a/src/xselect.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/xselect.c	Mon Jul 26 20:52:35 2010 -0700
@@ -76,7 +76,8 @@
 static Lisp_Object x_get_window_property_as_lisp_data (Display *,
                                                        Window, Atom,
                                                        Lisp_Object, Atom);
-static Lisp_Object selection_data_to_lisp_data (Display *, unsigned char *,
+static Lisp_Object selection_data_to_lisp_data (Display *,
+						const unsigned char *,
                                                 int, Atom, int);
 static void lisp_data_to_selection_data (Display *, Lisp_Object,
                                          unsigned char **, Atom *,
@@ -1758,7 +1759,8 @@
 
 
 static Lisp_Object
-selection_data_to_lisp_data (Display *display, unsigned char *data, int size, Atom type, int format)
+selection_data_to_lisp_data (Display *display, const unsigned char *data,
+			     int size, Atom type, int format)
 {
   struct x_display_info *dpyinfo = x_display_info_for_display (display);
 
@@ -2540,7 +2542,8 @@
    Also see comment for selection_data_to_lisp_data above.  */
 
 Lisp_Object
-x_property_data_to_lisp (struct frame *f, unsigned char *data, Atom type, int format, long unsigned int size)
+x_property_data_to_lisp (struct frame *f, const unsigned char *data,
+			 Atom type, int format, long unsigned int size)
 {
   return selection_data_to_lisp_data (FRAME_X_DISPLAY (f),
                                       data, size*format/8, type, format);
--- a/src/xterm.c	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/xterm.c	Mon Jul 26 20:52:35 2010 -0700
@@ -104,8 +104,7 @@
 #endif
 
 #ifdef USE_LUCID
-extern int xlwmenu_window_p (Widget w, Window window);
-extern void xlwmenu_redisplay (Widget);
+#include "../lwlib/xlwmenu.h"
 #endif
 
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
@@ -332,7 +331,8 @@
 
 extern Lisp_Object Vinhibit_redisplay;
 
-extern XrmDatabase x_load_resources (Display *, char *, char *, char *);
+extern XrmDatabase x_load_resources (Display *, const char *, const char *,
+				     const char *);
 extern int x_bitmap_mask (FRAME_PTR, int);
 
 static int x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
@@ -379,7 +379,7 @@
                               int *, struct input_event *);
 /* Don't declare this NO_RETURN because we want no
    interference with debugging failing X calls.  */
-static SIGTYPE x_connection_closed (Display *, char *);
+static SIGTYPE x_connection_closed (Display *, const char *);
 
 
 /* Flush display of frame F, or of all frames if F is null.  */
@@ -7359,7 +7359,7 @@
    Use ICON_NAME as the text.  */
 
 int
-x_text_icon (struct frame *f, char *icon_name)
+x_text_icon (struct frame *f, const char *icon_name)
 {
   if (FRAME_X_WINDOW (f) == 0)
     return 1;
@@ -7422,7 +7422,7 @@
 
    Calling x_uncatch_errors resumes the normal error handling.  */
 
-void x_check_errors (Display *dpy, char *format);
+void x_check_errors (Display *dpy, const char *format);
 
 void
 x_catch_errors (Display *dpy)
@@ -7464,7 +7464,7 @@
    sprintf (a buffer, FORMAT, the x error message text) as the text.  */
 
 void
-x_check_errors (Display *dpy, char *format)
+x_check_errors (Display *dpy, const char *format)
 {
   /* Make sure to catch any errors incurred so far.  */
   XSync (dpy, False);
@@ -7568,7 +7568,7 @@
    the text of an error message that lead to the connection loss.  */
 
 static SIGTYPE
-x_connection_closed (Display *dpy, char *error_message)
+x_connection_closed (Display *dpy, const char *error_message)
 {
   struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
   Lisp_Object frame, tail;
--- a/src/xterm.h	Mon Jul 26 19:45:53 2010 -0700
+++ b/src/xterm.h	Mon Jul 26 20:52:35 2010 -0700
@@ -936,15 +936,16 @@
 
 /* From xrdb.c.  */
 
-char *x_get_customization_string (XrmDatabase, char *, char *);
-XrmDatabase x_load_resources (Display *, char *, char *, char *);
-int x_get_resource (XrmDatabase, char *, char *,
+char *x_get_customization_string (XrmDatabase, const char *, const char *);
+XrmDatabase x_load_resources (Display *, const char *, const char *,
+			      const char *);
+int x_get_resource (XrmDatabase, const char *, const char *,
                     XrmRepresentation, XrmValue *);
 void x_delete_display (struct x_display_info *);
 void x_make_frame_visible (struct frame *);
 void x_iconify_frame (struct frame *);
 void x_wm_set_size_hint (struct frame *, long, int);
-int x_text_icon (struct frame *, char *);
+int x_text_icon (struct frame *, const char *);
 int x_bitmap_icon (struct frame *, Lisp_Object);
 void x_set_window_size (struct frame *, int, int, int);
 void x_wm_set_window_state (struct frame *, int);
@@ -954,10 +955,10 @@
 
 extern void cancel_mouse_face (struct frame *);
 extern void x_scroll_bar_clear (struct frame *);
-extern int x_text_icon (struct frame *, char *);
+extern int x_text_icon (struct frame *, const char *);
 extern int x_bitmap_icon (struct frame *, Lisp_Object);
 extern void x_catch_errors (Display *);
-extern void x_check_errors (Display *, char *);
+extern void x_check_errors (Display *, const char *);
 extern int x_had_errors_p (Display *);
 extern int x_catching_errors (void);
 extern void x_uncatch_errors (void);
@@ -1018,7 +1019,7 @@
                                   void *,
                                   int);
 extern Lisp_Object x_property_data_to_lisp (struct frame *,
-                                            unsigned char *,
+                                            const unsigned char *,
                                             Atom,
                                             int,
                                             unsigned long);
@@ -1033,7 +1034,7 @@
 #endif /* USE_GTK */
 
 extern void x_real_positions (struct frame *, int *, int *);
-extern int defined_color (struct frame *, char *, XColor *, int);
+extern int defined_color (struct frame *, const char *, XColor *, int);
 extern void x_set_border_pixel (struct frame *, int);
 extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
 extern void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
@@ -1042,14 +1043,14 @@
 extern void destroy_frame_xic (struct frame *);
 extern void xic_set_preeditarea (struct window *, int, int);
 extern void xic_set_statusarea (struct frame *);
-extern void xic_set_xfontset (struct frame *, char *);
+extern void xic_set_xfontset (struct frame *, const char *);
 extern int x_pixel_width (struct frame *);
 extern int x_pixel_height (struct frame *);
 extern int x_char_width (struct frame *);
 extern int x_char_height (struct frame *);
 extern int x_screen_planes (struct frame *);
 extern void x_sync (struct frame *);
-extern int x_defined_color (struct frame *, char *, XColor *, int);
+extern int x_defined_color (struct frame *, const char *, XColor *, int);
 #ifdef HAVE_X_I18N
 extern void free_frame_xic (struct frame *);
 #endif