aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-04-16 08:15:17 -0700
committerPaul Eggert2011-04-16 08:15:17 -0700
commiteb18f6cc6644a9e43204e5062f9fd45fdad8141f (patch)
tree7f534563dfa5ea69827392b484b6f614bb3df717 /src
parent1fe72bf8610f908150f44357a86076bfddc7c26f (diff)
downloademacs-eb18f6cc6644a9e43204e5062f9fd45fdad8141f.tar.gz
emacs-eb18f6cc6644a9e43204e5062f9fd45fdad8141f.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/xmenu.c22
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 @@
12011-04-16 Paul Eggert <eggert@cs.ucla.edu> 12011-04-16 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * xmenu.c (menu_help_callback): Pointer type fixes.
4 Use const pointers when pointing at readonly data. Avoid pointer
5 signedness clashes.
6 (FALSE): Remove unused macro.
7 (update_frame_menubar): Remove unused decl.
8
3 * xfns.c (Fx_hide_tip): Move locals to avoid shadowing. 9 * xfns.c (Fx_hide_tip): Move locals to avoid shadowing.
4 10
5 * menu.c (push_submenu_start, push_submenu_end): Do not define unless 11 * 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 <http://www.gnu.org/licenses/>. */
108 108
109#ifndef TRUE 109#ifndef TRUE
110#define TRUE 1 110#define TRUE 1
111#define FALSE 0
112#endif /* no TRUE */ 111#endif /* no TRUE */
113 112
114static Lisp_Object Qdebug_on_next_call; 113static Lisp_Object Qdebug_on_next_call;
@@ -117,8 +116,6 @@ static Lisp_Object Qdebug_on_next_call;
117static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object, 116static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object,
118 const char **); 117 const char **);
119#endif 118#endif
120
121static int update_frame_menubar (struct frame *);
122 119
123/* Flag which when set indicates a dialog or menu has been posted by 120/* Flag which when set indicates a dialog or menu has been posted by
124 Xt on behalf of one of the widget sets. */ 121 Xt on behalf of one of the widget sets. */
@@ -2185,7 +2182,7 @@ static struct frame *menu_help_frame;
2185 keyboard events. */ 2182 keyboard events. */
2186 2183
2187static void 2184static void
2188menu_help_callback (char *help_string, int pane, int item) 2185menu_help_callback (char const *help_string, int pane, int item)
2189{ 2186{
2190 Lisp_Object *first_item; 2187 Lisp_Object *first_item;
2191 Lisp_Object pane_name; 2188 Lisp_Object pane_name;
@@ -2358,32 +2355,29 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2358 { 2355 {
2359 /* Create a new item within current pane. */ 2356 /* Create a new item within current pane. */
2360 Lisp_Object item_name, enable, descrip, help; 2357 Lisp_Object item_name, enable, descrip, help;
2361 unsigned char *item_data; 2358 char *item_data;
2362 char *help_string; 2359 char const *help_string;
2363 2360
2364 item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; 2361 item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
2365 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; 2362 enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
2366 descrip 2363 descrip
2367 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; 2364 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
2368 help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; 2365 help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
2369 help_string = STRINGP (help) ? SDATA (help) : NULL; 2366 help_string = STRINGP (help) ? SSDATA (help) : NULL;
2370 2367
2371 if (!NILP (descrip)) 2368 if (!NILP (descrip))
2372 { 2369 {
2373 int gap = maxwidth - SBYTES (item_name);
2374 /* if alloca is fast, use that to make the space, 2370 /* if alloca is fast, use that to make the space,
2375 to reduce gc needs. */ 2371 to reduce gc needs. */
2376 item_data 2372 item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1);
2377 = (unsigned char *) alloca (maxwidth 2373 memcpy (item_data, SSDATA (item_name), SBYTES (item_name));
2378 + SBYTES (descrip) + 1);
2379 memcpy (item_data, SDATA (item_name), SBYTES (item_name));
2380 for (j = SCHARS (item_name); j < maxwidth; j++) 2374 for (j = SCHARS (item_name); j < maxwidth; j++)
2381 item_data[j] = ' '; 2375 item_data[j] = ' ';
2382 memcpy (item_data + j, SDATA (descrip), SBYTES (descrip)); 2376 memcpy (item_data + j, SSDATA (descrip), SBYTES (descrip));
2383 item_data[j + SBYTES (descrip)] = 0; 2377 item_data[j + SBYTES (descrip)] = 0;
2384 } 2378 }
2385 else 2379 else
2386 item_data = SDATA (item_name); 2380 item_data = SSDATA (item_name);
2387 2381
2388 if (XMenuAddSelection (FRAME_X_DISPLAY (f), 2382 if (XMenuAddSelection (FRAME_X_DISPLAY (f),
2389 menu, lpane, 0, item_data, 2383 menu, lpane, 0, item_data,