From eb18f6cc6644a9e43204e5062f9fd45fdad8141f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 16 Apr 2011 08:15:17 -0700 Subject: [PATCH] * xmenu.c (menu_help_callback): Pointer type fixes. Use const pointers when pointing at readonly data. Avoid pointer signedness clashes. (FALSE): Remove unused macro. (update_frame_menubar): Remove unused decl. --- src/ChangeLog | 6 ++++++ src/xmenu.c | 22 ++++++++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6afd3836568..8eedcae2d8b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2011-04-16 Paul Eggert + * xmenu.c (menu_help_callback): Pointer type fixes. + Use const pointers when pointing at readonly data. Avoid pointer + signedness clashes. + (FALSE): Remove unused macro. + (update_frame_menubar): Remove unused decl. + * xfns.c (Fx_hide_tip): Move locals to avoid shadowing. * menu.c (push_submenu_start, push_submenu_end): Do not define unless diff --git a/src/xmenu.c b/src/xmenu.c index d1f0594337d..f5bbca14047 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -108,7 +108,6 @@ along with GNU Emacs. If not, see . */ #ifndef TRUE #define TRUE 1 -#define FALSE 0 #endif /* no TRUE */ static Lisp_Object Qdebug_on_next_call; @@ -117,8 +116,6 @@ static Lisp_Object Qdebug_on_next_call; static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object, const char **); #endif - -static int update_frame_menubar (struct frame *); /* Flag which when set indicates a dialog or menu has been posted by Xt on behalf of one of the widget sets. */ @@ -2185,7 +2182,7 @@ static struct frame *menu_help_frame; keyboard events. */ static void -menu_help_callback (char *help_string, int pane, int item) +menu_help_callback (char const *help_string, int pane, int item) { Lisp_Object *first_item; Lisp_Object pane_name; @@ -2358,32 +2355,29 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, { /* Create a new item within current pane. */ Lisp_Object item_name, enable, descrip, help; - unsigned char *item_data; - char *help_string; + char *item_data; + char const *help_string; item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; descrip = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; - help_string = STRINGP (help) ? SDATA (help) : NULL; + help_string = STRINGP (help) ? SSDATA (help) : NULL; if (!NILP (descrip)) { - int gap = maxwidth - SBYTES (item_name); /* if alloca is fast, use that to make the space, to reduce gc needs. */ - item_data - = (unsigned char *) alloca (maxwidth - + SBYTES (descrip) + 1); - memcpy (item_data, SDATA (item_name), SBYTES (item_name)); + item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1); + memcpy (item_data, SSDATA (item_name), SBYTES (item_name)); for (j = SCHARS (item_name); j < maxwidth; j++) item_data[j] = ' '; - memcpy (item_data + j, SDATA (descrip), SBYTES (descrip)); + memcpy (item_data + j, SSDATA (descrip), SBYTES (descrip)); item_data[j + SBYTES (descrip)] = 0; } else - item_data = SDATA (item_name); + item_data = SSDATA (item_name); if (XMenuAddSelection (FRAME_X_DISPLAY (f), menu, lpane, 0, item_data,