changeset 14546:bc0388a7c282

(xmalloc_widget_value): New function. Use it instead of malloc_widget_value.
author Richard M. Stallman <rms@gnu.org>
date Sun, 11 Feb 1996 20:31:53 +0000
parents bd43252760b4
children eac92e94d52f
files src/xmenu.c
diffstat 1 files changed, 28 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/xmenu.c	Sun Feb 11 19:27:29 1996 +0000
+++ b/src/xmenu.c	Sun Feb 11 20:31:53 1996 +0000
@@ -116,6 +116,20 @@
 static void list_of_panes ();
 static void list_of_items ();
 
+/* Allocate a widget_value, blocking input.  */
+
+widget_value
+xmalloc_widget_value ()
+{
+  widget_value value;
+
+  BLOCK_INPUT;
+  value = malloc_widget_value ();
+  UNBLOCK_INPUT;
+
+  return value;
+}
+
 /* This holds a Lisp vector that holds the results of decoding
    the keymaps or alist-of-alists that specify a menu.
 
@@ -1373,7 +1387,7 @@
 
   submenu_stack
     = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
-  wv = malloc_widget_value ();
+  wv = xmalloc_widget_value ();
   wv->name = "menu";
   wv->value = 0;
   wv->enabled = 1;
@@ -1427,7 +1441,7 @@
 	     with its items as a submenu beneath it.  */
 	  if (strcmp (pane_string, ""))
 	    {
-	      wv = malloc_widget_value ();
+	      wv = xmalloc_widget_value ();
 	      if (save_wv)
 		save_wv->next = wv;
 	      else
@@ -1454,7 +1468,7 @@
 	    = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
 	  def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION];
 
-	  wv = malloc_widget_value ();
+	  wv = xmalloc_widget_value ();
 	  if (prev_wv) 
 	    prev_wv->next = wv;
 	  else
@@ -1570,7 +1584,7 @@
   if (! menubar_widget)
     deep_p = 1;
 
-  wv = malloc_widget_value ();
+  wv = xmalloc_widget_value ();
   wv->name = "menubar";
   wv->value = 0;
   wv->enabled = 1;
@@ -1695,7 +1709,7 @@
 	  if (NILP (string))
 	    break;
 
-	  wv = malloc_widget_value ();
+	  wv = xmalloc_widget_value ();
 	  wv->name = (char *) XSTRING (string)->data;
 	  wv->value = 0;
 	  wv->enabled = 1;
@@ -1883,7 +1897,7 @@
 
   /* Create a tree of widget_value objects
      representing the panes and their items.  */
-  wv = malloc_widget_value ();
+  wv = xmalloc_widget_value ();
   wv->name = "menu";
   wv->value = 0;
   wv->enabled = 1;
@@ -1935,7 +1949,7 @@
 	     with its items as a submenu beneath it.  */
 	  if (!keymaps && strcmp (pane_string, ""))
 	    {
-	      wv = malloc_widget_value ();
+	      wv = xmalloc_widget_value ();
 	      if (save_wv)
 		save_wv->next = wv;
 	      else
@@ -1966,7 +1980,7 @@
 	    = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
 	  def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION];
 
-	  wv = malloc_widget_value ();
+	  wv = xmalloc_widget_value ();
 	  if (prev_wv) 
 	    prev_wv->next = wv;
 	  else 
@@ -1990,9 +2004,9 @@
   /* Deal with the title, if it is non-nil.  */
   if (!NILP (title))
     {
-      widget_value *wv_title = malloc_widget_value ();
-      widget_value *wv_sep1 = malloc_widget_value ();
-      widget_value *wv_sep2 = malloc_widget_value ();
+      widget_value *wv_title = xmalloc_widget_value ();
+      widget_value *wv_sep1 = xmalloc_widget_value ();
+      widget_value *wv_sep2 = xmalloc_widget_value ();
 
       wv_sep2->name = "--";
       wv_sep2->next = first_wv->contents;
@@ -2195,7 +2209,7 @@
     prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];
     pane_string = (NILP (pane_name)
 		   ? "" : (char *) XSTRING (pane_name)->data);  
-    prev_wv = malloc_widget_value ();
+    prev_wv = xmalloc_widget_value ();
     prev_wv->value = pane_string;
     if (keymaps && !NILP (prefix))
       prev_wv->name++;
@@ -2236,7 +2250,7 @@
 	    return Qnil;
 	  }
 
-	wv = malloc_widget_value ();
+	wv = xmalloc_widget_value ();
 	prev_wv->next = wv;
 	wv->name = (char *) button_names[nb_buttons];
 	if (!NILP (descrip))
@@ -2258,7 +2272,7 @@
     if (! boundary_seen)
       left_count = nb_buttons - nb_buttons / 2;
 
-    wv = malloc_widget_value ();
+    wv = xmalloc_widget_value ();
     wv->name = dialog_name;
 
     /* Dialog boxes use a really stupid name encoding