]> code.delx.au - gnu-emacs/blobdiff - src/menu.c
Report readdir failures
[gnu-emacs] / src / menu.c
index 8c624f758a929cfb1ebf123cbf364eb1603ca584..5a8ea34242f2a65ea012ad56d1f741b576ae616f 100644 (file)
@@ -1,6 +1,6 @@
 /* Platform-independent code for terminal communications.
 
-Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2014 Free Software
+Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2015 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -354,7 +354,7 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
      front of them.  */
   if (!have_boxes ())
     {
-      Lisp_Object prefix = Qnil;
+      char const *prefix = 0;
       Lisp_Object type = AREF (item_properties, ITEM_PROPERTY_TYPE);
       if (!NILP (type))
        {
@@ -389,8 +389,11 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
                    {
                      if (!submenu && SREF (tem, 0) != '\0'
                          && SREF (tem, 0) != '-')
-                       ASET (menu_items, idx + MENU_ITEMS_ITEM_NAME,
-                             concat2 (build_string ("    "), tem));
+                       {
+                         AUTO_STRING (spaces, "    ");
+                         ASET (menu_items, idx + MENU_ITEMS_ITEM_NAME,
+                               concat2 (spaces, tem));
+                       }
                      idx += MENU_ITEMS_ITEM_LENGTH;
                    }
                }
@@ -399,24 +402,30 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
 
          /* Calculate prefix, if any, for this item.  */
          if (EQ (type, QCtoggle))
-           prefix = build_string (NILP (selected) ? "[ ] " : "[X] ");
+           prefix = NILP (selected) ? "[ ] " : "[X] ";
          else if (EQ (type, QCradio))
-           prefix = build_string (NILP (selected) ? "( ) " : "(*) ");
+           prefix = NILP (selected) ? "( ) " : "(*) ";
        }
       /* Not a button. If we have earlier buttons, then we need a prefix.  */
       else if (!skp->notbuttons && SREF (item_string, 0) != '\0'
               && SREF (item_string, 0) != '-')
-       prefix = build_string ("    ");
+       prefix = "    ";
 
-      if (!NILP (prefix))
-       item_string = concat2 (prefix, item_string);
+      if (prefix)
+       {
+         AUTO_STRING (prefix_obj, prefix);
+         item_string = concat2 (prefix_obj, item_string);
+       }
   }
 
   if ((FRAME_TERMCAP_P (XFRAME (Vmenu_updating_frame))
        || FRAME_MSDOS_P (XFRAME (Vmenu_updating_frame)))
       && !NILP (map))
     /* Indicate visually that this is a submenu.  */
-    item_string = concat2 (item_string, build_string (" >"));
+    {
+      AUTO_STRING (space_gt, " >");
+      item_string = concat2 (item_string, space_gt);
+    }
 
   push_menu_item (item_string, enabled, key,
                  AREF (item_properties, ITEM_PROPERTY_DEF),