From 648801d1f58ba038a4ec3217de38032d40b2a98e Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Fri, 6 Aug 2010 11:41:15 -0700 Subject: [PATCH] Use const for some arrays and functions. * src/xterm.h (xg_set_icon_from_xpm_data): * src/xfns.c (xg_set_icon_from_xpm_data): * src/term.c (fkeys): * src/keyboard.c (lispy_accent_keys, lispy_function_keys) (lispy_multimedia_keys, lispy_kana_keys, iso_lispy_function_keys) (lispy_drag_n_drop_names, scroll_bar_parts, modify_event_symbol) (frame.c frame_parms): * src/emacs-icon.h (gnu_xpm_bits): * src/callint.c (callint_argfuns): Use const. --- src/ChangeLog | 13 +++++++++++++ src/callint.c | 2 +- src/emacs-icon.h | 2 +- src/keyboard.c | 22 +++++++++++----------- src/term.c | 3 +-- src/xfns.c | 4 ++-- src/xterm.h | 2 +- 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 30b73ffdf4f..af16fc651c7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2010-08-06 Dan Nicolaescu + + Use const for some arrays and functions. + * xterm.h (xg_set_icon_from_xpm_data): + * xfns.c (xg_set_icon_from_xpm_data): + * term.c (fkeys): + * keyboard.c (lispy_accent_keys, lispy_function_keys) + (lispy_multimedia_keys, lispy_kana_keys, iso_lispy_function_keys) + (lispy_drag_n_drop_names, scroll_bar_parts, modify_event_symbol) + (frame.c frame_parms): + * emacs-icon.h (gnu_xpm_bits): + * callint.c (callint_argfuns): Use const. + 2010-08-06 Jan Djärv * sysdep.c: Move include term.h last of includes (Bug#6812). diff --git a/src/callint.c b/src/callint.c index 11473c3473a..ae11c7cb24d 100644 --- a/src/callint.c +++ b/src/callint.c @@ -149,7 +149,7 @@ quotify_args (Lisp_Object exp) return exp; } -char *callint_argfuns[] +static const char *callint_argfuns[] = {"", "point", "mark", "region-beginning", "region-end"}; static void diff --git a/src/emacs-icon.h b/src/emacs-icon.h index 42c7d80bbe0..82f0a6e701c 100644 --- a/src/emacs-icon.h +++ b/src/emacs-icon.h @@ -23,7 +23,7 @@ along with GNU Emacs. If not, see . */ /* Note that the GTK port uses gdk to display the icon, so Emacs need not have XPM support compiled in. */ #if (defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)) || defined (USE_GTK) -static char * gnu_xpm_bits[] = { +static const char * gnu_xpm_bits[] = { /* width height ncolors chars_per_pixel */ "32 32 255 2", /* colors */ diff --git a/src/keyboard.c b/src/keyboard.c index 9114e2dbbca..872f787c506 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -613,7 +613,7 @@ static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object, unsigned long); #endif static Lisp_Object modify_event_symbol (int, unsigned, Lisp_Object, - Lisp_Object, char **, + Lisp_Object, const char **, Lisp_Object *, unsigned); static Lisp_Object make_lispy_switch_frame (Lisp_Object); static void save_getcjmp (jmp_buf); @@ -4724,7 +4724,7 @@ static const int lispy_accent_codes[] = /* This is a list of Lisp names for special "accent" characters. It parallels lispy_accent_codes. */ -static char *lispy_accent_keys[] = +static const char *lispy_accent_keys[] = { "dead-circumflex", "dead-grave", @@ -4751,7 +4751,7 @@ static char *lispy_accent_keys[] = #ifdef HAVE_NTGUI #define FUNCTION_KEY_OFFSET 0x0 -char *lispy_function_keys[] = +char const *lispy_function_keys[] = { 0, /* 0 */ @@ -4945,7 +4945,7 @@ char *lispy_function_keys[] = /* Some of these duplicate the "Media keys" on newer keyboards, but they are delivered to the application in a different way. */ -static char *lispy_multimedia_keys[] = +static const char *lispy_multimedia_keys[] = { 0, "browser-back", @@ -5009,7 +5009,7 @@ static char *lispy_multimedia_keys[] = the XK_kana_A case below. */ #if 0 #ifdef XK_kana_A -static char *lispy_kana_keys[] = +static const char *lispy_kana_keys[] = { /* X Keysym value */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x400 .. 0x40f */ @@ -5048,7 +5048,7 @@ static char *lispy_kana_keys[] = /* You'll notice that this table is arranged to be conveniently indexed by X Windows keysym values. */ -static char *lispy_function_keys[] = +static const char *lispy_function_keys[] = { /* X Keysym value */ @@ -5134,7 +5134,7 @@ static char *lispy_function_keys[] = /* ISO 9995 Function and Modifier Keys; the first byte is 0xFE. */ #define ISO_FUNCTION_KEY_OFFSET 0xfe00 -static char *iso_lispy_function_keys[] = +static const char *iso_lispy_function_keys[] = { 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe00 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe08 */ @@ -5157,14 +5157,14 @@ static char *iso_lispy_function_keys[] = Lisp_Object Vlispy_mouse_stem; -static char *lispy_wheel_names[] = +static const char *lispy_wheel_names[] = { "wheel-up", "wheel-down", "wheel-left", "wheel-right" }; /* drag-n-drop events are generated when a set of selected files are dragged from another application and dropped onto an Emacs window. */ -static char *lispy_drag_n_drop_names[] = +static const char *lispy_drag_n_drop_names[] = { "drag-n-drop" }; @@ -5175,7 +5175,7 @@ Lisp_Object Qup, Qdown, Qbottom, Qend_scroll; Lisp_Object Qtop, Qratio; /* An array of scroll bar parts, indexed by an enum scroll_bar_part value. */ -Lisp_Object *scroll_bar_parts[] = { +const Lisp_Object *scroll_bar_parts[] = { &Qabove_handle, &Qhandle, &Qbelow_handle, &Qup, &Qdown, &Qtop, &Qbottom, &Qend_scroll, &Qratio }; @@ -6542,7 +6542,7 @@ reorder_modifiers (Lisp_Object symbol) static Lisp_Object modify_event_symbol (int symbol_num, unsigned int modifiers, Lisp_Object symbol_kind, - Lisp_Object name_alist_or_stem, char **name_table, + Lisp_Object name_alist_or_stem, const char **name_table, Lisp_Object *symbol_table, unsigned int table_size) { Lisp_Object value; diff --git a/src/term.c b/src/term.c index 6fb26c77851..96f9ce02f9b 100644 --- a/src/term.c +++ b/src/term.c @@ -1266,7 +1266,7 @@ struct fkey_table { other keys (as on the IBM PC keyboard) they get overridden. */ -static struct fkey_table keys[] = +static const struct fkey_table keys[] = { {"kh", "home"}, /* termcap */ {"kl", "left"}, /* termcap */ @@ -2906,7 +2906,6 @@ term_mouse_highlight (struct frame *f, int x, int y) /* Look for a `help-echo' property. */ { Lisp_Object help; - extern Lisp_Object Qhelp_echo; /* Check overlays first. */ help = Qnil; diff --git a/src/xfns.c b/src/xfns.c index 7695f829804..ecf7e150b0c 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -762,10 +762,10 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file) } int -xg_set_icon_from_xpm_data (FRAME_PTR f, char **data) +xg_set_icon_from_xpm_data (FRAME_PTR f, const char **data) { int result = 0; - GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) data); + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data); if (!pixbuf) return 0; diff --git a/src/xterm.h b/src/xterm.h index 69c8ec22a73..972bfb50dc3 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -1062,7 +1062,7 @@ extern Lisp_Object x_get_focus_frame (struct frame *); #ifdef USE_GTK extern int xg_set_icon (struct frame *, Lisp_Object); -extern int xg_set_icon_from_xpm_data (struct frame *, char**); +extern int xg_set_icon_from_xpm_data (struct frame *, const char**); #endif /* USE_GTK */ extern void x_real_positions (struct frame *, int *, int *); -- 2.39.2