changeset 109718:77fb60d4233b

Merge changes from emacs-23 branch.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 08 Aug 2010 17:15:44 -0400
parents 8949aad5e992 (diff) df8e0cd18128 (current diff)
children 472b3dda3de7
files src/ChangeLog src/charset.c src/coding.c src/xfns.c
diffstat 19 files changed, 91 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/ChangeLog	Sun Aug 08 17:15:44 2010 -0400
@@ -32,6 +32,34 @@
 
 2010-08-08  Dan Nicolaescu  <dann@ics.uci.edu>
 
+	Use const char* instead of char*.
+	* xterm.c (x_create_toolkit_scroll_bar):
+	* xfont.c (xfont_list_pattern):
+	* xfns.c (x_default_scroll_bar_color_parameter)
+	(xic_create_fontsetname, x_default_font_parameter)
+	(x_screen_planes):
+	* xdisp.c (c_string_pos, number_of_chars, reseat_to_string)
+	(store_mode_line_string, decode_mode_spec, display_string):
+	* menu.c (digest_single_submenu):
+	* keymap.h (initial_define_key, initial_define_lispy_key):
+	* keymap.c (initial_define_key, initial_define_lispy_key):
+	* image.c (image_error, image_keyword):
+	* gtkutil.h (xg_create_widget, xg_create_scroll_bar):
+	* gtkutil.c (xg_create_widget, xg_create_scroll_bar):
+	* ftfont.c (struct fc_charset_table, ftfont_spec_pattern)
+	(ftfont_list, ftfont_match):
+	* frame.c (frame_parm_table):
+	* font.h (font_intern_prop, font_parse_xlfd, font_parse_fcname)
+	(font_unparse_fcname, font_unparse_fcname, font_open_by_name)
+	(font_add_log, font_deferred_log):
+	* font.c (font_intern_prop, font_parse_xlfd, font_parse_fcname)
+	(font_unparse_fcname, font_unparse_fcname, font_open_by_name)
+	(font_add_log, font_deferred_log):
+	* emacs.c (argmatch):
+	* dispextern.h (struct it):
+	* coding.c (ENCODE_DESIGNATION):
+	* charset.c (define_charset_internal): Use const.
+
 	* s/freebsd.h (DECLARE_GETPWUID_WITH_UID_T): Remove, unused.
 
 	* xrdb.c: Remove include guard.  Remove
--- a/src/charset.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/charset.c	Sun Aug 08 17:15:44 2010 -0400
@@ -1266,7 +1266,7 @@
 static int
 define_charset_internal (Lisp_Object name,
 			 int dimension,
-			 unsigned char *code_space,
+			 const unsigned char *code_space,
 			 unsigned min_code, unsigned max_code,
 			 int iso_final, int iso_revision, int emacs_mule_id,
 			 int ascii_compatible, int supplementary,
--- a/src/coding.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/coding.c	Sun Aug 08 17:15:44 2010 -0400
@@ -4097,8 +4097,8 @@
 #define ENCODE_DESIGNATION(charset, reg, coding)			\
   do {									\
     unsigned char final_char = CHARSET_ISO_FINAL (charset);		\
-    char *intermediate_char_94 = "()*+";				\
-    char *intermediate_char_96 = ",-./";				\
+    const char *intermediate_char_94 = "()*+";				\
+    const char *intermediate_char_96 = ",-./";				\
     int revision = -1;							\
     int c;								\
 									\
--- a/src/dispextern.h	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/dispextern.h	Sun Aug 08 17:15:44 2010 -0400
@@ -2050,7 +2050,7 @@
   /* C string to iterate over.  Non-null means get characters from
      this string, otherwise characters are read from current_buffer
      or it->string.  */
-  unsigned char *s;
+  const unsigned char *s;
 
   /* Number of characters in the string (s, or it->string) we iterate
      over.  */
--- a/src/emacs.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/emacs.c	Sun Aug 08 17:15:44 2010 -0400
@@ -629,7 +629,7 @@
    enough information to do it right.  */
 
 static int
-argmatch (char **argv, int argc, char *sstr, char *lstr, int minlen, char **valptr, int *skipptr)
+argmatch (char **argv, int argc, const char *sstr, const char *lstr, int minlen, char **valptr, int *skipptr)
 {
   char *p = NULL;
   int arglen;
--- a/src/font.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/font.c	Sun Aug 08 17:15:44 2010 -0400
@@ -232,7 +232,7 @@
    STR.  */
 
 Lisp_Object
-font_intern_prop (char *str, int len, int force_symbol)
+font_intern_prop (const char *str, int len, int force_symbol)
 {
   int i;
   Lisp_Object tem;
@@ -981,7 +981,7 @@
    a fully specified XLFD.  */
 
 int
-font_parse_xlfd (char *name, Lisp_Object font)
+font_parse_xlfd (const char *name, Lisp_Object font)
 {
   int len = strlen (name);
   int i, j, n;
@@ -1306,7 +1306,7 @@
    This function tries to guess which format it is.  */
 
 int
-font_parse_fcname (char *name, Lisp_Object font)
+font_parse_fcname (const char *name, Lisp_Object font)
 {
   char *p, *q;
   char *size_beg = NULL, *size_end = NULL;
@@ -1563,7 +1563,7 @@
    FONT_SIZE_INDEX of FONT is 0, use PIXEL_SIZE instead.  */
 
 int
-font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
+font_unparse_fcname (Lisp_Object font, int pixel_size, const char *name, int nbytes)
 {
   Lisp_Object family, foundry;
   Lisp_Object tail, val;
@@ -1571,7 +1571,7 @@
   int i, len = 1;
   char *p;
   Lisp_Object styles[3];
-  char *style_names[3] = { "weight", "slant", "width" };
+  const char *style_names[3] = { "weight", "slant", "width" };
   char work[256];
 
   family = AREF (font, FONT_FAMILY_INDEX);
@@ -3506,7 +3506,7 @@
    found, return Qnil.  */
 
 Lisp_Object
-font_open_by_name (FRAME_PTR f, char *name)
+font_open_by_name (FRAME_PTR f, const char *name)
 {
   Lisp_Object args[2];
   Lisp_Object spec, ret;
@@ -5060,7 +5060,7 @@
    opening), ARG is the argument for the action, and RESULT is the
    result of the action.  */
 void
-font_add_log (char *action, Lisp_Object arg, Lisp_Object result)
+font_add_log (const char *action, Lisp_Object arg, Lisp_Object result)
 {
   Lisp_Object tail, val;
   int i;
@@ -5146,7 +5146,7 @@
    as font_add_log.  */
 
 void
-font_deferred_log (char *action, Lisp_Object arg, Lisp_Object result)
+font_deferred_log (const char *action, Lisp_Object arg, Lisp_Object result)
 {
   if (EQ (Vfont_log, Qt))
     return;
--- a/src/font.h	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/font.h	Sun Aug 08 17:15:44 2010 -0400
@@ -783,10 +783,10 @@
 extern void font_done_for_face (FRAME_PTR f, struct face *face);
 
 extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec);
-extern Lisp_Object font_open_by_name (FRAME_PTR f, char *name);
+extern Lisp_Object font_open_by_name (FRAME_PTR f, const char *name);
 extern void font_close_object (FRAME_PTR f, Lisp_Object font_object);
 
-extern Lisp_Object font_intern_prop (char *str, int len, int force_symbol);
+extern Lisp_Object font_intern_prop (const char *str, int len, int force_symbol);
 extern void font_update_sort_order (int *order);
 
 extern void font_parse_family_registry (Lisp_Object family,
@@ -795,12 +795,12 @@
 extern Lisp_Object font_spec_from_family_registry (Lisp_Object family,
                                                    Lisp_Object registry);
 
-extern int font_parse_xlfd (char *name, Lisp_Object font);
+extern int font_parse_xlfd (const char *name, Lisp_Object font);
 extern int font_unparse_xlfd (Lisp_Object font, int pixel_size,
                               char *name, int bytes);
-extern int font_parse_fcname (char *name, Lisp_Object font);
+extern int font_parse_fcname (const char *name, Lisp_Object font);
 extern int font_unparse_fcname (Lisp_Object font, int pixel_size,
-                                char *name, int bytes);
+                                const char *name, int bytes);
 extern int font_unparse_gtkname (Lisp_Object, struct frame *, char *, int);
 extern void register_font_driver (struct font_driver *driver, FRAME_PTR f);
 extern void free_font_driver_list (FRAME_PTR f);
@@ -856,8 +856,8 @@
 extern Lisp_Object QCfoundry, QCadstyle, QCregistry;
 
 extern Lisp_Object Vfont_log;
-extern void font_add_log (char *, Lisp_Object, Lisp_Object);
-extern void font_deferred_log (char *, Lisp_Object, Lisp_Object);
+extern void font_add_log (const char *, Lisp_Object, Lisp_Object);
+extern void font_deferred_log (const char *, Lisp_Object, Lisp_Object);
 
 #define FONT_ADD_LOG(ACTION, ARG, RESULT)	\
   do {						\
--- a/src/frame.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/frame.c	Sun Aug 08 17:15:44 2010 -0400
@@ -2770,7 +2770,7 @@
    that is an index in this table.  */
 
 struct frame_parm_table {
-  char *name;
+  const char *name;
   Lisp_Object *variable;
 };
 
--- a/src/ftfont.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/ftfont.c	Sun Aug 08 17:15:44 2010 -0400
@@ -96,11 +96,11 @@
 static struct
 {
   /* registry name */
-  char *name;
+  const char *name;
   /* characters to distinguish the charset from the others */
   int uniquifier[6];
   /* additional constraint by language */
-  char *lang;
+  const char *lang;
   /* set on demand */
   FcCharSet *fc_charset;
 } fc_charset_table[] =
@@ -691,12 +691,8 @@
   return spec;
 }
 
-static FcPattern *ftfont_spec_pattern (Lisp_Object, char *,
-                                       struct OpenTypeSpec **,
-                                       char **langname);
-
 static FcPattern *
-ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **otspec, char **langname)
+ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **otspec, const char **langname)
 {
   Lisp_Object tmp, extra;
   FcPattern *pattern = NULL;
@@ -866,7 +862,7 @@
   char otlayout[15];		/* For "otlayout:XXXX" */
   struct OpenTypeSpec *otspec = NULL;
   int spacing = -1;
-  char *langname = NULL;
+  const char *langname = NULL;
 
   if (! fc_initialized)
     {
@@ -1057,7 +1053,7 @@
   FcResult result;
   char otlayout[15];		/* For "otlayout:XXXX" */
   struct OpenTypeSpec *otspec = NULL;
-  char *langname = NULL;
+  const char *langname = NULL;
 
   if (! fc_initialized)
     {
@@ -2630,7 +2626,7 @@
 
         if (strcmp (ftfont_booleans[i], keystr) == 0)
           {
-            char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL;
+            const char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL;
             if (INTEGERP (val)) str = XINT (val) != 0 ? "true" : "false";
             if (str == NULL) str = "true";
 
--- a/src/gtkutil.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/gtkutil.c	Sun Aug 08 17:15:44 2010 -0400
@@ -2370,7 +2370,7 @@
    Returns the widget created.  */
 
 GtkWidget *
-xg_create_widget (char *type, char *name, FRAME_PTR f, widget_value *val,
+xg_create_widget (const char *type, const char *name, FRAME_PTR f, widget_value *val,
                   GCallback select_cb, GCallback deactivate_cb,
 		  GCallback highlight_cb)
 {
@@ -3233,7 +3233,7 @@
                       struct scroll_bar *bar,
                       GCallback scroll_callback,
                       GCallback end_callback,
-                      char *scroll_bar_name)
+                      const char *scroll_bar_name)
 {
   GtkWidget *wscroll;
   GtkWidget *webox;
--- a/src/gtkutil.h	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/gtkutil.h	Sun Aug 08 17:15:44 2010 -0400
@@ -135,8 +135,8 @@
 
 extern char *xg_get_font_name (FRAME_PTR f, char *);
 
-extern GtkWidget *xg_create_widget (char *type,
-                                    char *name,
+extern GtkWidget *xg_create_widget (const char *type,
+                                    const char *name,
                                     FRAME_PTR f,
                                     widget_value *val,
                                     GCallback select_cb,
@@ -163,7 +163,7 @@
                                   struct scroll_bar *bar,
                                   GCallback scroll_callback,
                                   GCallback end_callback,
-                                  char *scroll_bar_name);
+                                  const char *scroll_bar_name);
 extern void xg_remove_scroll_bar (FRAME_PTR f, int scrollbar_id);
 
 extern void xg_update_scrollbar_pos (FRAME_PTR f,
--- a/src/image.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/image.c	Sun Aug 08 17:15:44 2010 -0400
@@ -598,7 +598,7 @@
 
 static Lisp_Object define_image_type (struct image_type *type, int loaded);
 static struct image_type *lookup_image_type (Lisp_Object symbol);
-static void image_error (char *format, Lisp_Object, Lisp_Object);
+static void image_error (const char *format, Lisp_Object, Lisp_Object);
 static void x_laplace (struct frame *, struct image *);
 static void x_emboss (struct frame *, struct image *);
 static int x_build_heuristic_mask (struct frame *, struct image *,
@@ -699,7 +699,7 @@
    therefore simply displays a message.  */
 
 static void
-image_error (char *format, Lisp_Object arg1, Lisp_Object arg2)
+image_error (const char *format, Lisp_Object arg1, Lisp_Object arg2)
 {
   add_to_log (format, arg1, arg2);
 }
@@ -731,7 +731,7 @@
 struct image_keyword
 {
   /* Name of keyword.  */
-  char *name;
+  const char *name;
 
   /* The type of value allowed.  */
   enum image_value_type type;
--- a/src/keymap.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/keymap.c	Sun Aug 08 17:15:44 2010 -0400
@@ -174,13 +174,13 @@
    initial_define_key (control_x_map, Ctl('X'), "exchange-point-and-mark");  */
 
 void
-initial_define_key (Lisp_Object keymap, int key, char *defname)
+initial_define_key (Lisp_Object keymap, int key, const char *defname)
 {
   store_in_keymap (keymap, make_number (key), intern_c_string (defname));
 }
 
 void
-initial_define_lispy_key (Lisp_Object keymap, char *keyname, char *defname)
+initial_define_lispy_key (Lisp_Object keymap, const char *keyname, const char *defname)
 {
   store_in_keymap (keymap, intern_c_string (keyname), intern_c_string (defname));
 }
--- a/src/keymap.h	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/keymap.h	Sun Aug 08 17:15:44 2010 -0400
@@ -45,8 +45,8 @@
 extern void describe_map_tree (Lisp_Object, int, Lisp_Object, Lisp_Object,
                                char *, int, int, int, int);
 extern int current_minor_maps (Lisp_Object **, Lisp_Object **);
-extern void initial_define_key (Lisp_Object, int, char *);
-extern void initial_define_lispy_key (Lisp_Object, char *, char *);
+extern void initial_define_key (Lisp_Object, int, const char *);
+extern void initial_define_lispy_key (Lisp_Object, const char *, const char *);
 extern void syms_of_keymap (void);
 extern void keys_of_keymap (void);
 
--- a/src/menu.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/menu.c	Sun Aug 08 17:15:44 2010 -0400
@@ -662,7 +662,7 @@
 	{
 	  /* Create a new pane.  */
 	  Lisp_Object pane_name, prefix;
-	  char *pane_string;
+	  const char *pane_string;
 
 	  panes_seen++;
 
--- a/src/xdisp.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/xdisp.c	Sun Aug 08 17:15:44 2010 -0400
@@ -430,7 +430,7 @@
 Lisp_Object Qrect, Qcircle, Qpoly;
 
 /* Tool bar styles */
-Lisp_Object Qtext, Qboth, Qboth_horiz, Qtext_image_horiz;
+Lisp_Object Qboth, Qboth_horiz, Qtext_image_horiz;
 
 /* Non-zero means print newline to stdout before next mini-buffer
    message.  */
@@ -992,12 +992,12 @@
 static int display_mode_lines (struct window *);
 static int display_mode_line (struct window *, enum face_id, Lisp_Object);
 static int display_mode_element (struct it *, int, int, int, Lisp_Object, Lisp_Object, int);
-static int store_mode_line_string (char *, Lisp_Object, int, int, int, Lisp_Object);
-static char *decode_mode_spec (struct window *, int, int, int,
-                               Lisp_Object *);
+static int store_mode_line_string (const char *, Lisp_Object, int, int, int, Lisp_Object);
+static const char *decode_mode_spec (struct window *, int, int, int,
+				     Lisp_Object *);
 static void display_menu_bar (struct window *);
 static int display_count_lines (int, int, int, int, int *);
-static int display_string (unsigned char *, Lisp_Object, Lisp_Object,
+static int display_string (const unsigned char *, Lisp_Object, Lisp_Object,
                            EMACS_INT, EMACS_INT, struct it *, int, int, int, int);
 static void compute_line_metrics (struct it *);
 static void run_redisplay_end_trigger_hook (struct it *);
@@ -1020,7 +1020,7 @@
 static void load_overlay_strings (struct it *, int);
 static int init_from_display_pos (struct it *, struct window *,
                                   struct display_pos *);
-static void reseat_to_string (struct it *, unsigned char *,
+static void reseat_to_string (struct it *, const unsigned char *,
                               Lisp_Object, int, int, int, int);
 static enum move_it_result
        move_it_in_display_line_to (struct it *, EMACS_INT, int,
@@ -1035,8 +1035,8 @@
 static struct text_pos string_pos_nchars_ahead (struct text_pos,
                                                 Lisp_Object, int);
 static struct text_pos string_pos (int, Lisp_Object);
-static struct text_pos c_string_pos (int, unsigned char *, int);
-static int number_of_chars (unsigned char *, int);
+static struct text_pos c_string_pos (int, const unsigned char *, int);
+static int number_of_chars (const unsigned char *, int);
 static void compute_stop_pos (struct it *);
 static void compute_string_pos (struct text_pos *, struct text_pos,
                                 Lisp_Object);
@@ -1548,7 +1548,7 @@
    means recognize multibyte characters.  */
 
 static struct text_pos
-c_string_pos (int charpos, unsigned char *s, int multibyte_p)
+c_string_pos (int charpos, const unsigned char *s, int multibyte_p)
 {
   struct text_pos pos;
 
@@ -1580,7 +1580,7 @@
    non-zero means recognize multibyte characters.  */
 
 static int
-number_of_chars (unsigned char *s, int multibyte_p)
+number_of_chars (const unsigned char *s, int multibyte_p)
 {
   int nchars;
 
@@ -5581,7 +5581,7 @@
    calling this function.  */
 
 static void
-reseat_to_string (struct it *it, unsigned char *s, Lisp_Object string,
+reseat_to_string (struct it *it, const unsigned char *s, Lisp_Object string,
 		  int charpos, int precision, int field_width, int multibyte)
 {
   /* No region in strings.  */
@@ -18538,7 +18538,7 @@
 		  {
 		    int multibyte;
 		    int bytepos, charpos;
-		    unsigned char *spec;
+		    const unsigned char *spec;
 		    Lisp_Object string;
 
 		    bytepos = percent_position;
@@ -18808,7 +18808,7 @@
  */
 
 static int
-store_mode_line_string (char *string, Lisp_Object lisp_string, int copy_string,
+store_mode_line_string (const char *string, Lisp_Object lisp_string, int copy_string,
 			int field_width, int precision, Lisp_Object props)
 {
   int len;
@@ -19224,7 +19224,7 @@
 
 static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------";
 
-static char *
+static const char *
 decode_mode_spec (struct window *w, register int c, int field_width,
 		  int precision, Lisp_Object *string)
 {
@@ -19784,7 +19784,7 @@
    Value is the number of columns displayed.  */
 
 static int
-display_string (unsigned char *string, Lisp_Object lisp_string, Lisp_Object face_string,
+display_string (const unsigned char *string, Lisp_Object lisp_string, Lisp_Object face_string,
 		EMACS_INT face_string_pos, EMACS_INT start, struct it *it,
 		int field_width, int precision, int max_x, int multibyte)
 {
--- a/src/xfns.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/xfns.c	Sun Aug 08 17:15:44 2010 -0400
@@ -501,7 +501,7 @@
 static Lisp_Object x_default_scroll_bar_color_parameter (struct frame *,
                                                          Lisp_Object,
                                                          Lisp_Object,
-                                                         char *, char *,
+                                                         const char *, const char *,
                                                          int);
 
 
@@ -1767,7 +1767,7 @@
 static Lisp_Object
 x_default_scroll_bar_color_parameter (struct frame *f,
 				      Lisp_Object alist, Lisp_Object prop,
-				      char *xprop, char *xclass,
+				      const char *xprop, const char *xclass,
 				      int foreground_p)
 {
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
@@ -2138,7 +2138,7 @@
 	}
       if (! xfs)
 	{
-	  char *last_resort = "-*-*-*-r-normal--*-*-*-*-*-*";
+	  const char *last_resort = "-*-*-*-r-normal--*-*-*-*-*-*";
 
 	  missing_list = NULL;
 	  xfs = XCreateFontSet (FRAME_X_DISPLAY (f), last_resort,
@@ -3011,7 +3011,7 @@
 
   if (! FONTP (font) && ! STRINGP (font))
     {
-      char *names[]
+      const char *names[]
 	= {
 #ifdef HAVE_XFT
 	    /* This will find the normal Xft font.  */
@@ -3740,7 +3740,7 @@
   (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
-  char *vendor = ServerVendor (dpyinfo->display);
+  const char *vendor = ServerVendor (dpyinfo->display);
 
   if (! vendor) vendor = "";
   return build_string (vendor);
@@ -3934,7 +3934,7 @@
 
 static struct visual_class
 {
-  char *name;
+  const char *name;
   int class;
 }
 visual_classes[] =
--- a/src/xfont.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/xfont.c	Sun Aug 08 17:15:44 2010 -0400
@@ -334,7 +334,7 @@
 }
 
 static Lisp_Object
-xfont_list_pattern (Display *display, char *pattern,
+xfont_list_pattern (Display *display, const char *pattern,
 		    Lisp_Object registry, Lisp_Object script)
 {
   Lisp_Object list = Qnil;
--- a/src/xterm.c	Sun Aug 08 17:12:29 2010 -0400
+++ b/src/xterm.c	Sun Aug 08 17:15:44 2010 -0400
@@ -22,11 +22,7 @@
 /* Xt features made by Fred Pierresteguy.  */
 
 #include <config.h>
-
-/* On 4.3 these lose if they come after xterm.h.  */
-/* Putting these at the beginning seems to be standard for other .c files.  */
 #include <signal.h>
-
 #include <stdio.h>
 #include <setjmp.h>
 
@@ -107,11 +103,6 @@
 #include "../lwlib/xlwmenu.h"
 #endif
 
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
-
-extern void free_frame_menubar (struct frame *);
-#endif
-
 #ifdef USE_X_TOOLKIT
 #if !defined(NO_EDITRES)
 #define HACK_EDITRES
@@ -4380,7 +4371,7 @@
 static void
 x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
 {
-  char *scroll_bar_name = SCROLL_BAR_NAME;
+  const char *scroll_bar_name = SCROLL_BAR_NAME;
 
   BLOCK_INPUT;
   xg_create_scroll_bar (f, bar, G_CALLBACK (xg_scroll_callback),