aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu.c
diff options
context:
space:
mode:
authorPaul Eggert2013-10-08 13:04:40 -0700
committerPaul Eggert2013-10-08 13:04:40 -0700
commit3b158d1150cbbffc77afef323008623ac5c3e169 (patch)
tree41f4cf689afbcc23831c56d5556a1ab46db88d46 /src/menu.c
parentc7a7f318ff5593331341d05a762a765f52e6bdd2 (diff)
downloademacs-3b158d1150cbbffc77afef323008623ac5c3e169.tar.gz
emacs-3b158d1150cbbffc77afef323008623ac5c3e169.zip
Fix minor problems found by static checking.
* dispnew.c (save_current_matrix): Omit unnecessary casts. * dispnew.c (update_frame_with_menu): Mark debug local as used. * keyboard.c, keyboard.h (Qmouse_movement): Now static. * keyboard.c (read_menu_command): Remove unused local. * lisp.h (read_menu_command): New decl. * menu.c, menu.h (menu_item_width): Arg is now unsigned char *, for benefit of STRING_CHAR_AND_LENGTH. All uses changed. Return ptrdiff_t, not int. * term.c (tty_menu_struct): 'allocated' member is now ptrdiff_t, not int, for benefit of xpalloc. (tty_menu_create, tty_menu_make_room): Simplify by using xzalloc and xpalloc. (have_menus_p): Remove; unused. (tty_menu_add_pane, tty_menu_add_selection): Change signedness of local char * pointer to pacify STRING_CHAR_AND_LENGTH. (tty_menu_add_selection, tty_menu_locate, tty_meny_destroy): Now static. (save_and_enable_current_matrix): Omit unnecessary casts. (read_menu_input): Omit local extern decl (now in lisp.h). Don't access uninitialized storage if mouse_get_xy fails. (tty_menu_activate): Mark local as initialized, for lint. (tty_menu_activate, tty_meny_show): Remove unused locals.
Diffstat (limited to 'src/menu.c')
-rw-r--r--src/menu.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/menu.c b/src/menu.c
index f741d686cd1..9e135b56ce5 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1036,11 +1036,11 @@ find_and_return_menu_selection (struct frame *f, bool keymaps, void *client_data
1036} 1036}
1037#endif /* HAVE_NS */ 1037#endif /* HAVE_NS */
1038 1038
1039int 1039ptrdiff_t
1040menu_item_width (const char *str) 1040menu_item_width (const unsigned char *str)
1041{ 1041{
1042 int len; 1042 ptrdiff_t len;
1043 const char *p; 1043 const unsigned char *p;
1044 1044
1045 for (len = 0, p = str; *p; ) 1045 for (len = 0, p = str; *p; )
1046 { 1046 {
@@ -1104,7 +1104,7 @@ into menu items. */)
1104 if (XINT (pos) <= col 1104 if (XINT (pos) <= col
1105 /* We use <= so the blank between 2 items on a TTY is 1105 /* We use <= so the blank between 2 items on a TTY is
1106 considered part of the previous item. */ 1106 considered part of the previous item. */
1107 && col <= XINT (pos) + menu_item_width (SSDATA (str))) 1107 && col <= XINT (pos) + menu_item_width (SDATA (str)))
1108 { 1108 {
1109 item = AREF (items, i); 1109 item = AREF (items, i);
1110 return item; 1110 return item;