diff options
| author | Richard M. Stallman | 1996-02-11 20:31:53 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-02-11 20:31:53 +0000 |
| commit | f7fab165d07ce7839ba8233da95514ed63099b26 (patch) | |
| tree | 04e6f915c0fa2caf8bd412f01212dd442517787f /src | |
| parent | cb4d47c527ab6abee7bf3043485a33ce2d3c5f3b (diff) | |
| download | emacs-f7fab165d07ce7839ba8233da95514ed63099b26.tar.gz emacs-f7fab165d07ce7839ba8233da95514ed63099b26.zip | |
(xmalloc_widget_value): New function.
Use it instead of malloc_widget_value.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xmenu.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index 36d15e50b9b..df4a5e3e30e 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -116,6 +116,20 @@ static void single_keymap_panes (); | |||
| 116 | static void list_of_panes (); | 116 | static void list_of_panes (); |
| 117 | static void list_of_items (); | 117 | static void list_of_items (); |
| 118 | 118 | ||
| 119 | /* Allocate a widget_value, blocking input. */ | ||
| 120 | |||
| 121 | widget_value | ||
| 122 | xmalloc_widget_value () | ||
| 123 | { | ||
| 124 | widget_value value; | ||
| 125 | |||
| 126 | BLOCK_INPUT; | ||
| 127 | value = malloc_widget_value (); | ||
| 128 | UNBLOCK_INPUT; | ||
| 129 | |||
| 130 | return value; | ||
| 131 | } | ||
| 132 | |||
| 119 | /* This holds a Lisp vector that holds the results of decoding | 133 | /* This holds a Lisp vector that holds the results of decoding |
| 120 | the keymaps or alist-of-alists that specify a menu. | 134 | the keymaps or alist-of-alists that specify a menu. |
| 121 | 135 | ||
| @@ -1373,7 +1387,7 @@ single_submenu (item_key, item_name, maps) | |||
| 1373 | 1387 | ||
| 1374 | submenu_stack | 1388 | submenu_stack |
| 1375 | = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); | 1389 | = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); |
| 1376 | wv = malloc_widget_value (); | 1390 | wv = xmalloc_widget_value (); |
| 1377 | wv->name = "menu"; | 1391 | wv->name = "menu"; |
| 1378 | wv->value = 0; | 1392 | wv->value = 0; |
| 1379 | wv->enabled = 1; | 1393 | wv->enabled = 1; |
| @@ -1427,7 +1441,7 @@ single_submenu (item_key, item_name, maps) | |||
| 1427 | with its items as a submenu beneath it. */ | 1441 | with its items as a submenu beneath it. */ |
| 1428 | if (strcmp (pane_string, "")) | 1442 | if (strcmp (pane_string, "")) |
| 1429 | { | 1443 | { |
| 1430 | wv = malloc_widget_value (); | 1444 | wv = xmalloc_widget_value (); |
| 1431 | if (save_wv) | 1445 | if (save_wv) |
| 1432 | save_wv->next = wv; | 1446 | save_wv->next = wv; |
| 1433 | else | 1447 | else |
| @@ -1454,7 +1468,7 @@ single_submenu (item_key, item_name, maps) | |||
| 1454 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; | 1468 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; |
| 1455 | def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION]; | 1469 | def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION]; |
| 1456 | 1470 | ||
| 1457 | wv = malloc_widget_value (); | 1471 | wv = xmalloc_widget_value (); |
| 1458 | if (prev_wv) | 1472 | if (prev_wv) |
| 1459 | prev_wv->next = wv; | 1473 | prev_wv->next = wv; |
| 1460 | else | 1474 | else |
| @@ -1570,7 +1584,7 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 1570 | if (! menubar_widget) | 1584 | if (! menubar_widget) |
| 1571 | deep_p = 1; | 1585 | deep_p = 1; |
| 1572 | 1586 | ||
| 1573 | wv = malloc_widget_value (); | 1587 | wv = xmalloc_widget_value (); |
| 1574 | wv->name = "menubar"; | 1588 | wv->name = "menubar"; |
| 1575 | wv->value = 0; | 1589 | wv->value = 0; |
| 1576 | wv->enabled = 1; | 1590 | wv->enabled = 1; |
| @@ -1695,7 +1709,7 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 1695 | if (NILP (string)) | 1709 | if (NILP (string)) |
| 1696 | break; | 1710 | break; |
| 1697 | 1711 | ||
| 1698 | wv = malloc_widget_value (); | 1712 | wv = xmalloc_widget_value (); |
| 1699 | wv->name = (char *) XSTRING (string)->data; | 1713 | wv->name = (char *) XSTRING (string)->data; |
| 1700 | wv->value = 0; | 1714 | wv->value = 0; |
| 1701 | wv->enabled = 1; | 1715 | wv->enabled = 1; |
| @@ -1883,7 +1897,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 1883 | 1897 | ||
| 1884 | /* Create a tree of widget_value objects | 1898 | /* Create a tree of widget_value objects |
| 1885 | representing the panes and their items. */ | 1899 | representing the panes and their items. */ |
| 1886 | wv = malloc_widget_value (); | 1900 | wv = xmalloc_widget_value (); |
| 1887 | wv->name = "menu"; | 1901 | wv->name = "menu"; |
| 1888 | wv->value = 0; | 1902 | wv->value = 0; |
| 1889 | wv->enabled = 1; | 1903 | wv->enabled = 1; |
| @@ -1935,7 +1949,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 1935 | with its items as a submenu beneath it. */ | 1949 | with its items as a submenu beneath it. */ |
| 1936 | if (!keymaps && strcmp (pane_string, "")) | 1950 | if (!keymaps && strcmp (pane_string, "")) |
| 1937 | { | 1951 | { |
| 1938 | wv = malloc_widget_value (); | 1952 | wv = xmalloc_widget_value (); |
| 1939 | if (save_wv) | 1953 | if (save_wv) |
| 1940 | save_wv->next = wv; | 1954 | save_wv->next = wv; |
| 1941 | else | 1955 | else |
| @@ -1966,7 +1980,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 1966 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; | 1980 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; |
| 1967 | def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION]; | 1981 | def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION]; |
| 1968 | 1982 | ||
| 1969 | wv = malloc_widget_value (); | 1983 | wv = xmalloc_widget_value (); |
| 1970 | if (prev_wv) | 1984 | if (prev_wv) |
| 1971 | prev_wv->next = wv; | 1985 | prev_wv->next = wv; |
| 1972 | else | 1986 | else |
| @@ -1990,9 +2004,9 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 1990 | /* Deal with the title, if it is non-nil. */ | 2004 | /* Deal with the title, if it is non-nil. */ |
| 1991 | if (!NILP (title)) | 2005 | if (!NILP (title)) |
| 1992 | { | 2006 | { |
| 1993 | widget_value *wv_title = malloc_widget_value (); | 2007 | widget_value *wv_title = xmalloc_widget_value (); |
| 1994 | widget_value *wv_sep1 = malloc_widget_value (); | 2008 | widget_value *wv_sep1 = xmalloc_widget_value (); |
| 1995 | widget_value *wv_sep2 = malloc_widget_value (); | 2009 | widget_value *wv_sep2 = xmalloc_widget_value (); |
| 1996 | 2010 | ||
| 1997 | wv_sep2->name = "--"; | 2011 | wv_sep2->name = "--"; |
| 1998 | wv_sep2->next = first_wv->contents; | 2012 | wv_sep2->next = first_wv->contents; |
| @@ -2195,7 +2209,7 @@ xdialog_show (f, keymaps, title, error) | |||
| 2195 | prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; | 2209 | prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; |
| 2196 | pane_string = (NILP (pane_name) | 2210 | pane_string = (NILP (pane_name) |
| 2197 | ? "" : (char *) XSTRING (pane_name)->data); | 2211 | ? "" : (char *) XSTRING (pane_name)->data); |
| 2198 | prev_wv = malloc_widget_value (); | 2212 | prev_wv = xmalloc_widget_value (); |
| 2199 | prev_wv->value = pane_string; | 2213 | prev_wv->value = pane_string; |
| 2200 | if (keymaps && !NILP (prefix)) | 2214 | if (keymaps && !NILP (prefix)) |
| 2201 | prev_wv->name++; | 2215 | prev_wv->name++; |
| @@ -2236,7 +2250,7 @@ xdialog_show (f, keymaps, title, error) | |||
| 2236 | return Qnil; | 2250 | return Qnil; |
| 2237 | } | 2251 | } |
| 2238 | 2252 | ||
| 2239 | wv = malloc_widget_value (); | 2253 | wv = xmalloc_widget_value (); |
| 2240 | prev_wv->next = wv; | 2254 | prev_wv->next = wv; |
| 2241 | wv->name = (char *) button_names[nb_buttons]; | 2255 | wv->name = (char *) button_names[nb_buttons]; |
| 2242 | if (!NILP (descrip)) | 2256 | if (!NILP (descrip)) |
| @@ -2258,7 +2272,7 @@ xdialog_show (f, keymaps, title, error) | |||
| 2258 | if (! boundary_seen) | 2272 | if (! boundary_seen) |
| 2259 | left_count = nb_buttons - nb_buttons / 2; | 2273 | left_count = nb_buttons - nb_buttons / 2; |
| 2260 | 2274 | ||
| 2261 | wv = malloc_widget_value (); | 2275 | wv = xmalloc_widget_value (); |
| 2262 | wv->name = dialog_name; | 2276 | wv->name = dialog_name; |
| 2263 | 2277 | ||
| 2264 | /* Dialog boxes use a really stupid name encoding | 2278 | /* Dialog boxes use a really stupid name encoding |