mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-21 10:24:55 +00:00
* 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.
This commit is contained in:
parent
1fe72bf861
commit
eb18f6cc66
@ -1,5 +1,11 @@
|
|||||||
2011-04-16 Paul Eggert <eggert@cs.ucla.edu>
|
2011-04-16 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
|
* 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.
|
* xfns.c (Fx_hide_tip): Move locals to avoid shadowing.
|
||||||
|
|
||||||
* menu.c (push_submenu_start, push_submenu_end): Do not define unless
|
* menu.c (push_submenu_start, push_submenu_end): Do not define unless
|
||||||
|
22
src/xmenu.c
22
src/xmenu.c
@ -108,7 +108,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
|
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#define FALSE 0
|
|
||||||
#endif /* no TRUE */
|
#endif /* no TRUE */
|
||||||
|
|
||||||
static Lisp_Object Qdebug_on_next_call;
|
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,
|
static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object,
|
||||||
const char **);
|
const char **);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int update_frame_menubar (struct frame *);
|
|
||||||
|
|
||||||
/* Flag which when set indicates a dialog or menu has been posted by
|
/* Flag which when set indicates a dialog or menu has been posted by
|
||||||
Xt on behalf of one of the widget sets. */
|
Xt on behalf of one of the widget sets. */
|
||||||
@ -2185,7 +2182,7 @@ static struct frame *menu_help_frame;
|
|||||||
keyboard events. */
|
keyboard events. */
|
||||||
|
|
||||||
static void
|
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 *first_item;
|
||||||
Lisp_Object pane_name;
|
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. */
|
/* Create a new item within current pane. */
|
||||||
Lisp_Object item_name, enable, descrip, help;
|
Lisp_Object item_name, enable, descrip, help;
|
||||||
unsigned char *item_data;
|
char *item_data;
|
||||||
char *help_string;
|
char const *help_string;
|
||||||
|
|
||||||
item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
|
item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
|
||||||
enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
|
enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
|
||||||
descrip
|
descrip
|
||||||
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
|
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
|
||||||
help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
|
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))
|
if (!NILP (descrip))
|
||||||
{
|
{
|
||||||
int gap = maxwidth - SBYTES (item_name);
|
|
||||||
/* if alloca is fast, use that to make the space,
|
/* if alloca is fast, use that to make the space,
|
||||||
to reduce gc needs. */
|
to reduce gc needs. */
|
||||||
item_data
|
item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1);
|
||||||
= (unsigned char *) alloca (maxwidth
|
memcpy (item_data, SSDATA (item_name), SBYTES (item_name));
|
||||||
+ SBYTES (descrip) + 1);
|
|
||||||
memcpy (item_data, SDATA (item_name), SBYTES (item_name));
|
|
||||||
for (j = SCHARS (item_name); j < maxwidth; j++)
|
for (j = SCHARS (item_name); j < maxwidth; j++)
|
||||||
item_data[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;
|
item_data[j + SBYTES (descrip)] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
item_data = SDATA (item_name);
|
item_data = SSDATA (item_name);
|
||||||
|
|
||||||
if (XMenuAddSelection (FRAME_X_DISPLAY (f),
|
if (XMenuAddSelection (FRAME_X_DISPLAY (f),
|
||||||
menu, lpane, 0, item_data,
|
menu, lpane, 0, item_data,
|
||||||
|
Loading…
Reference in New Issue
Block a user