diff options
| author | Paul Eggert | 2011-04-29 00:54:43 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-29 00:54:43 -0700 |
| commit | 8ac068ac0c00afa85bc4df54032b7a855c639312 (patch) | |
| tree | 551b5146f8f0c9e5c2f7129eaac0fb9f97d8a866 /src/menu.c | |
| parent | c7b270ab8559d9c9ca86ed5887b86b537796042d (diff) | |
| download | emacs-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/menu.c')
| -rw-r--r-- | src/menu.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/menu.c b/src/menu.c index f637b92679a..5162ee083bf 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -800,9 +800,9 @@ digest_single_submenu (int start, int end, int top_level_items) | |||
| 800 | if (!NILP (descrip)) | 800 | if (!NILP (descrip)) |
| 801 | wv->lkey = descrip; | 801 | wv->lkey = descrip; |
| 802 | wv->value = 0; | 802 | wv->value = 0; |
| 803 | /* The EMACS_INT cast avoids a warning. There's no problem | 803 | /* The EMACS_INTPTR cast avoids a warning. There's no problem |
| 804 | as long as pointers have enough bits to hold small integers. */ | 804 | as long as pointers have enough bits to hold small integers. */ |
| 805 | wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0); | 805 | wv->call_data = (!NILP (def) ? (void *) (EMACS_INTPTR) i : 0); |
| 806 | wv->enabled = !NILP (enable); | 806 | wv->enabled = !NILP (enable); |
| 807 | 807 | ||
| 808 | if (NILP (type)) | 808 | if (NILP (type)) |
| @@ -911,9 +911,9 @@ find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object | |||
| 911 | else | 911 | else |
| 912 | { | 912 | { |
| 913 | entry = XVECTOR (vector)->contents[i + MENU_ITEMS_ITEM_VALUE]; | 913 | entry = XVECTOR (vector)->contents[i + MENU_ITEMS_ITEM_VALUE]; |
| 914 | /* The EMACS_INT cast avoids a warning. There's no problem | 914 | /* Treat the pointer as an integer. There's no problem |
| 915 | as long as pointers have enough bits to hold small integers. */ | 915 | as long as pointers have enough bits to hold small integers. */ |
| 916 | if ((int) (EMACS_INT) client_data == i) | 916 | if ((EMACS_INTPTR) client_data == i) |
| 917 | { | 917 | { |
| 918 | int j; | 918 | int j; |
| 919 | struct input_event buf; | 919 | struct input_event buf; |