diff options
| author | Paul Eggert | 2011-04-16 08:38:15 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-16 08:38:15 -0700 |
| commit | eef9bc799ad1f9c0df0cc23669496d9fbcc326ca (patch) | |
| tree | ed3978d0a16e26381f7ec50727c2b419a876bec3 /src | |
| parent | 098db9dd8b385f13ab74a37046a4cd98c8b314d6 (diff) | |
| download | emacs-eef9bc799ad1f9c0df0cc23669496d9fbcc326ca.tar.gz emacs-eef9bc799ad1f9c0df0cc23669496d9fbcc326ca.zip | |
* xmenu.c (xmenu_show): Don't use uninitialized vars.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 2 | ||||
| -rw-r--r-- | src/xmenu.c | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c009a8fadee..9a429af4b9e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2011-04-16 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-04-16 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * xmenu.c (xmenu_show): Don't use uninitialized vars. | ||
| 4 | |||
| 3 | * xterm.c: Fix problems found by static analysis with other toolkits. | 5 | * xterm.c: Fix problems found by static analysis with other toolkits. |
| 4 | (toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT. | 6 | (toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT. |
| 5 | (x_dispatch_event): Declare static only if !USE_GTK && USE_X_TOOLKIT. | 7 | (x_dispatch_event): Declare static only if !USE_GTK && USE_X_TOOLKIT. |
diff --git a/src/xmenu.c b/src/xmenu.c index f5bbca14047..938e5696b21 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -2299,7 +2299,8 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 2299 | y += f->top_pos; | 2299 | y += f->top_pos; |
| 2300 | 2300 | ||
| 2301 | /* Create all the necessary panes and their items. */ | 2301 | /* Create all the necessary panes and their items. */ |
| 2302 | maxlines = lines = i = 0; | 2302 | maxwidth = maxlines = lines = i = 0; |
| 2303 | lpane = XM_FAILURE; | ||
| 2303 | while (i < menu_items_used) | 2304 | while (i < menu_items_used) |
| 2304 | { | 2305 | { |
| 2305 | if (EQ (XVECTOR (menu_items)->contents[i], Qt)) | 2306 | if (EQ (XVECTOR (menu_items)->contents[i], Qt)) |
| @@ -2327,7 +2328,6 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 2327 | i += MENU_ITEMS_PANE_LENGTH; | 2328 | i += MENU_ITEMS_PANE_LENGTH; |
| 2328 | 2329 | ||
| 2329 | /* Find the width of the widest item in this pane. */ | 2330 | /* Find the width of the widest item in this pane. */ |
| 2330 | maxwidth = 0; | ||
| 2331 | j = i; | 2331 | j = i; |
| 2332 | while (j < menu_items_used) | 2332 | while (j < menu_items_used) |
| 2333 | { | 2333 | { |
| @@ -2379,10 +2379,11 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 2379 | else | 2379 | else |
| 2380 | item_data = SSDATA (item_name); | 2380 | item_data = SSDATA (item_name); |
| 2381 | 2381 | ||
| 2382 | if (XMenuAddSelection (FRAME_X_DISPLAY (f), | 2382 | if (lpane == XM_FAILURE |
| 2383 | menu, lpane, 0, item_data, | 2383 | || (XMenuAddSelection (FRAME_X_DISPLAY (f), |
| 2384 | !NILP (enable), help_string) | 2384 | menu, lpane, 0, item_data, |
| 2385 | == XM_FAILURE) | 2385 | !NILP (enable), help_string) |
| 2386 | == XM_FAILURE)) | ||
| 2386 | { | 2387 | { |
| 2387 | XMenuDestroy (FRAME_X_DISPLAY (f), menu); | 2388 | XMenuDestroy (FRAME_X_DISPLAY (f), menu); |
| 2388 | *error_name = "Can't add selection to menu"; | 2389 | *error_name = "Can't add selection to menu"; |
| @@ -2462,6 +2463,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 2462 | status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx, | 2463 | status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx, |
| 2463 | x, y, ButtonReleaseMask, &datap, | 2464 | x, y, ButtonReleaseMask, &datap, |
| 2464 | menu_help_callback); | 2465 | menu_help_callback); |
| 2466 | entry = pane_prefix = Qnil; | ||
| 2465 | 2467 | ||
| 2466 | switch (status) | 2468 | switch (status) |
| 2467 | { | 2469 | { |
| @@ -2508,14 +2510,12 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 2508 | case XM_FAILURE: | 2510 | case XM_FAILURE: |
| 2509 | *error_name = "Can't activate menu"; | 2511 | *error_name = "Can't activate menu"; |
| 2510 | case XM_IA_SELECT: | 2512 | case XM_IA_SELECT: |
| 2511 | entry = Qnil; | ||
| 2512 | break; | 2513 | break; |
| 2513 | case XM_NO_SELECT: | 2514 | case XM_NO_SELECT: |
| 2514 | /* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means | 2515 | /* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means |
| 2515 | the menu was invoked with a mouse event as POSITION). */ | 2516 | the menu was invoked with a mouse event as POSITION). */ |
| 2516 | if (! for_click) | 2517 | if (! for_click) |
| 2517 | Fsignal (Qquit, Qnil); | 2518 | Fsignal (Qquit, Qnil); |
| 2518 | entry = Qnil; | ||
| 2519 | break; | 2519 | break; |
| 2520 | } | 2520 | } |
| 2521 | 2521 | ||