aboutsummaryrefslogtreecommitdiffstats
path: root/src/xmenu.c
diff options
context:
space:
mode:
authorPaul Eggert2011-04-29 00:54:43 -0700
committerPaul Eggert2011-04-29 00:54:43 -0700
commit8ac068ac0c00afa85bc4df54032b7a855c639312 (patch)
tree551b5146f8f0c9e5c2f7129eaac0fb9f97d8a866 /src/xmenu.c
parentc7b270ab8559d9c9ca86ed5887b86b537796042d (diff)
downloademacs-8ac068ac0c00afa85bc4df54032b7a855c639312.tar.gz
emacs-8ac068ac0c00afa85bc4df54032b7a855c639312.zip
Prefer intptr_t/uintptr_t for integers the same widths as pointers.
This removes an assumption that EMACS_INT and long are the same width as pointers. The assumption is true for Emacs porting targets now, but we want to make other targets possible. * lisp.h: Include <inttypes.h>, for INTPTR_MAX, UINTPTR_MAX. (EMACS_INTPTR, EMACS_UINTPTR): New macros. In the rest of the code, change types of integers that hold casted pointers to EMACS_INTPTR and EMACS_UINTPTR, systematically replacing EMACS_INT, long, EMACS_UINT, and unsigned long. (XTYPE): Don't cast arg to EMACS_UINT; normally is not needed. (XSET): Cast type of XTYPE arg to EMACS_INTPTR; it is needed here. No need to cast type when ORing. (XPNTR): Return a value of type EMACS_INTPTR or EMACS_UINTPTR. * alloc.c (lisp_align_malloc): Remove a no-longer-needed cast. * doc.c (store_function_docstring): Use EMACS_INTPTR, so as not to assume EMACS_INT is the same width as char *. * gtkutil.c (xg_gtk_scroll_destroy, xg_tool_bar_button_cb): (xg_tool_bar_callback, xg_tool_bar_help_callback, xg_make_tool_item): Remove no-longer-needed casts. (xg_create_scroll_bar, xg_tool_bar_button_cb, xg_tool_bar_callback): (xg_tool_bar_help_callback, xg_make_tool_item): Use EMACS_INTPTR to hold an integer that will be cast to void *; this can avoid a GCC warning if EMACS_INT is not the same width as void *. * menu.c (find_and_call_menu_selection): Remove no-longer-needed cast. * xdisp.c (display_echo_area_1, resize_mini_window_1): (current_message_1, set_message_1): Use a local to convert to proper width without a cast. * xmenu.c (dialog_selection_callback): Likewise.
Diffstat (limited to 'src/xmenu.c')
-rw-r--r--src/xmenu.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index 2d6185c16e5..54f1fc666ec 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1139,9 +1139,9 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1139 wv->help = Qnil; 1139 wv->help = Qnil;
1140 /* This prevents lwlib from assuming this 1140 /* This prevents lwlib from assuming this
1141 menu item is really supposed to be empty. */ 1141 menu item is really supposed to be empty. */
1142 /* The EMACS_INT cast avoids a warning. 1142 /* The EMACS_INTPTR cast avoids a warning.
1143 This value just has to be different from small integers. */ 1143 This value just has to be different from small integers. */
1144 wv->call_data = (void *) (EMACS_INT) (-1); 1144 wv->call_data = (void *) (EMACS_INTPTR) (-1);
1145 1145
1146 if (prev_wv) 1146 if (prev_wv)
1147 prev_wv->next = wv; 1147 prev_wv->next = wv;
@@ -1876,9 +1876,9 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1876static void 1876static void
1877dialog_selection_callback (GtkWidget *widget, gpointer client_data) 1877dialog_selection_callback (GtkWidget *widget, gpointer client_data)
1878{ 1878{
1879 /* The EMACS_INT cast avoids a warning. There's no problem 1879 /* Treat the pointer as an integer. There's no problem
1880 as long as pointers have enough bits to hold small integers. */ 1880 as long as pointers have enough bits to hold small integers. */
1881 if ((int) (EMACS_INT) client_data != -1) 1881 if ((EMACS_INTPTR) client_data != -1)
1882 menu_item_selection = (Lisp_Object *) client_data; 1882 menu_item_selection = (Lisp_Object *) client_data;
1883 1883
1884 popup_activated_flag = 0; 1884 popup_activated_flag = 0;