emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117885: If USE_LOCAL_ALLOCATORS, allocate some Lisp


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117885: If USE_LOCAL_ALLOCATORS, allocate some Lisp objects on stack.
Date: Mon, 15 Sep 2014 14:53:50 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117885
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Mon 2014-09-15 18:53:23 +0400
message:
  If USE_LOCAL_ALLOCATORS, allocate some Lisp objects on stack.
  * lisp.h (local_cons, local_list1, local_list2, local_list3)
  [USE_LOCAL_ALLOCATORS]: New macros.
  [!USE_LOCAL_ALLOCATORS]: Fall back to regular functions.
  (build_local_string): Avoid argument name expansion clash with
  make_local_string.
  * alloc.c (toplevel)
  [USE_LOCAL_ALLOCATORS && GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS]:
  Preprocessor guard to avoid impossible configuration.
  * charset.c (Ffind_charset_region, Ffind_charset_string):
  Use make_local_vector.
  * lread.c (read1, substitute_object_recurse): Use scoped_cons.
  * textprop.c (Fput_text_property, Fadd_face_text_property):
  Use scoped_list2.
  (copy_text_properties): Use local_cons and local_list3.
  * chartab.c (uniprop_table):
  * data.c (wrong_choice, wrong_range):
  * doc.c (get_doc_string):
  * editfns.c (format2):
  * fileio.c (Fexpand_file_name, auto_save_error):
  * fns.c (Fyes_or_no_p):
  * font.c (font_parse_xlfd, font_parse_family_registry, font_add_log):
  * fontset.c (Fset_fontset_font):
  * keyboard.c (echo_add_key, echo_dash, parse_menu_item)
  (read_char_minibuf_menu_prompt):
  * keymap.c (silly_event_symbol_error, describe_vector):
  * menu.c (single_menu_item):
  * minibuf.c (Fread_buffer):
  * process.c (status_message, Fformat_network_address)
  (server_accept_connection): Use make_local_string and
  build_local_string.  Prefer compound literals where appropriate.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/alloc.c                    alloc.c-20091113204419-o5vbwnq5f7feedwu-252
  src/charset.c                  charset.c-20091113204419-o5vbwnq5f7feedwu-1075
  src/chartab.c                  chartab.c-20091113204419-o5vbwnq5f7feedwu-8539
  src/data.c                     data.c-20091113204419-o5vbwnq5f7feedwu-251
  src/doc.c                      doc.c-20091113204419-o5vbwnq5f7feedwu-250
  src/editfns.c                  editfns.c-20091113204419-o5vbwnq5f7feedwu-255
  src/fileio.c                   fileio.c-20091113204419-o5vbwnq5f7feedwu-210
  src/fns.c                      fns.c-20091113204419-o5vbwnq5f7feedwu-203
  src/font.c                     font.c-20091113204419-o5vbwnq5f7feedwu-8540
  src/fontset.c                  fontset.c-20091113204419-o5vbwnq5f7feedwu-1079
  src/keyboard.c                 keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
  src/keymap.c                   keymap.c-20091113204419-o5vbwnq5f7feedwu-219
  src/lisp.h                     lisp.h-20091113204419-o5vbwnq5f7feedwu-253
  src/lread.c                    lread.c-20091113204419-o5vbwnq5f7feedwu-266
  src/menu.c                     menu.c-20091113204419-o5vbwnq5f7feedwu-8676
  src/minibuf.c                  minibuf.c-20091113204419-o5vbwnq5f7feedwu-242
  src/process.c                  process.c-20091113204419-o5vbwnq5f7feedwu-462
  src/textprop.c                 textprop.c-20091113204419-o5vbwnq5f7feedwu-512
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-15 05:09:44 +0000
+++ b/src/ChangeLog     2014-09-15 14:53:23 +0000
@@ -1,3 +1,37 @@
+2014-09-15  Dmitry Antipov  <address@hidden>
+
+       If USE_LOCAL_ALLOCATORS, allocate some Lisp objects on stack.
+       * lisp.h (local_cons, local_list1, local_list2, local_list3)
+       [USE_LOCAL_ALLOCATORS]: New macros.
+       [!USE_LOCAL_ALLOCATORS]: Fall back to regular functions.
+       (build_local_string): Avoid argument name expansion clash with
+       make_local_string.
+       * alloc.c (toplevel)
+       [USE_LOCAL_ALLOCATORS && GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS]:
+       Preprocessor guard to avoid impossible configuration.
+       * charset.c (Ffind_charset_region, Ffind_charset_string):
+       Use make_local_vector.
+       * lread.c (read1, substitute_object_recurse): Use scoped_cons.
+       * textprop.c (Fput_text_property, Fadd_face_text_property):
+       Use scoped_list2.
+       (copy_text_properties): Use local_cons and local_list3.
+       * chartab.c (uniprop_table):
+       * data.c (wrong_choice, wrong_range):
+       * doc.c (get_doc_string):
+       * editfns.c (format2):
+       * fileio.c (Fexpand_file_name, auto_save_error):
+       * fns.c (Fyes_or_no_p):
+       * font.c (font_parse_xlfd, font_parse_family_registry, font_add_log):
+       * fontset.c (Fset_fontset_font):
+       * keyboard.c (echo_add_key, echo_dash, parse_menu_item)
+       (read_char_minibuf_menu_prompt):
+       * keymap.c (silly_event_symbol_error, describe_vector):
+       * menu.c (single_menu_item):
+       * minibuf.c (Fread_buffer):
+       * process.c (status_message, Fformat_network_address)
+       (server_accept_connection): Use make_local_string and
+       build_local_string.  Prefer compound literals where appropriate.
+
 2014-09-15  Daniel Colascione  <address@hidden>
 
        * fns.c (Fsort): Tweak sort docstring.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2014-09-11 19:44:25 +0000
+++ b/src/alloc.c       2014-09-15 14:53:23 +0000
@@ -69,6 +69,12 @@
 static bool valgrind_p;
 #endif
 
+#ifdef USE_LOCAL_ALLOCATORS
+# if GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS
+#  error "Stack-allocated Lisp objects are not compatible with GCPROs"
+# endif
+#endif
+
 /* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects.
    Doable only if GC_MARK_STACK.  */
 #if ! GC_MARK_STACK

=== modified file 'src/charset.c'
--- a/src/charset.c     2014-09-11 13:21:19 +0000
+++ b/src/charset.c     2014-09-15 14:53:23 +0000
@@ -1569,7 +1569,7 @@
 
   from_byte = CHAR_TO_BYTE (from);
 
-  charsets = Fmake_vector (make_number (charset_table_used), Qnil);
+  charsets = make_local_vector (charset_table_used, Qnil);
   while (1)
     {
       find_charsets_in_text (BYTE_POS_ADDR (from_byte), stop - from,
@@ -1606,7 +1606,7 @@
 
   CHECK_STRING (str);
 
-  charsets = Fmake_vector (make_number (charset_table_used), Qnil);
+  charsets = make_local_vector (charset_table_used, Qnil);
   find_charsets_in_text (SDATA (str), SCHARS (str), SBYTES (str),
                         charsets, table,
                         STRING_MULTIBYTE (str));

=== modified file 'src/chartab.c'
--- a/src/chartab.c     2014-07-08 07:17:04 +0000
+++ b/src/chartab.c     2014-09-15 14:53:23 +0000
@@ -1307,7 +1307,7 @@
     {
       struct gcpro gcpro1;
       GCPRO1 (val);
-      result = Fload (concat2 (build_string ("international/"), table),
+      result = Fload (concat2 (build_local_string ("international/"), table),
                      Qt, Qt, Qt, Qt);
       UNGCPRO;
       if (NILP (result))

=== modified file 'src/data.c'
--- a/src/data.c        2014-09-13 04:41:54 +0000
+++ b/src/data.c        2014-09-15 14:53:23 +0000
@@ -988,8 +988,9 @@
   for (obj = choice; !NILP (obj); obj = XCDR (obj))
     {
       args[i++] = SYMBOL_NAME (XCAR (obj));
-      args[i++] = build_string (NILP (XCDR (obj)) ? " should be specified"
-                               : (NILP (XCDR (XCDR (obj))) ? " or " : ", "));
+      args[i++] = build_local_string
+       (NILP (XCDR (obj)) ? " should be specified"
+        : (NILP (XCDR (XCDR (obj))) ? " or " : ", "));
     }
 
   obj = Fconcat (i, args);
@@ -1003,14 +1004,11 @@
 static void
 wrong_range (Lisp_Object min, Lisp_Object max, Lisp_Object wrong)
 {
-  Lisp_Object args[4];
-
-  args[0] = build_string ("Value should be from ");
-  args[1] = Fnumber_to_string (min);
-  args[2] = build_string (" to ");
-  args[3] = Fnumber_to_string (max);
-
-  xsignal2 (Qerror, Fconcat (4, args), wrong);
+  xsignal2 (Qerror, Fconcat (4, ((Lisp_Object [])
+    { build_local_string ("Value should be from "),
+      Fnumber_to_string (min),
+      build_local_string (" to "),
+      Fnumber_to_string (max) })), wrong);
 }
 
 /* Store NEWVAL into SYMBOL, where VALCONTENTS is found in the value cell

=== modified file 'src/doc.c'
--- a/src/doc.c 2014-09-07 07:04:01 +0000
+++ b/src/doc.c 2014-09-15 14:53:23 +0000
@@ -146,8 +146,8 @@
       if (fd < 0)
        {
          SAFE_FREE ();
-         return concat3 (build_string ("Cannot open doc string file \""),
-                         file, build_string ("\"\n"));
+         return concat3 (build_local_string ("Cannot open doc string file \""),
+                         file, build_local_string ("\"\n"));
        }
     }
   count = SPECPDL_INDEX ();

=== modified file 'src/editfns.c'
--- a/src/editfns.c     2014-09-07 07:04:01 +0000
+++ b/src/editfns.c     2014-09-15 14:53:23 +0000
@@ -4362,11 +4362,8 @@
 Lisp_Object
 format2 (const char *string1, Lisp_Object arg0, Lisp_Object arg1)
 {
-  Lisp_Object args[3];
-  args[0] = build_string (string1);
-  args[1] = arg0;
-  args[2] = arg1;
-  return Fformat (3, args);
+  return Fformat (3, ((Lisp_Object [])
+    { build_local_string (string1), arg0, arg1 }));
 }
 
 DEFUN ("char-equal", Fchar_equal, Schar_equal, 2, 2, 0,

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2014-09-13 04:41:54 +0000
+++ b/src/fileio.c      2014-09-15 14:53:23 +0000
@@ -1162,11 +1162,11 @@
              char newdir_utf8[MAX_UTF8_PATH];
 
              filename_from_ansi (newdir, newdir_utf8);
-             tem = build_string (newdir_utf8);
+             tem = build_local_string (newdir_utf8);
            }
          else
 #endif
-           tem = build_string (newdir);
+           tem = build_local_string (newdir);
          newdirlim = newdir + SBYTES (tem);
          if (multibyte && !STRING_MULTIBYTE (tem))
            {
@@ -1198,7 +1198,7 @@
              /* `getpwnam' may return a unibyte string, which will
                 bite us since we expect the directory to be
                 multibyte.  */
-             tem = build_string (newdir);
+             tem = build_local_string (newdir);
              newdirlim = newdir + SBYTES (tem);
              if (multibyte && !STRING_MULTIBYTE (tem))
                {
@@ -1231,7 +1231,7 @@
            adir = NULL;
          else if (multibyte)
            {
-             Lisp_Object tem = build_string (adir);
+             Lisp_Object tem = build_local_string (adir);
 
              tem = DECODE_FILE (tem);
              newdirlim = adir + SBYTES (tem);
@@ -1332,7 +1332,7 @@
            getcwd (adir, adir_size);
          if (multibyte)
            {
-             Lisp_Object tem = build_string (adir);
+             Lisp_Object tem = build_local_string (adir);
 
              tem = DECODE_FILE (tem);
              newdirlim = adir + SBYTES (tem);
@@ -5408,7 +5408,7 @@
 static Lisp_Object
 auto_save_error (Lisp_Object error_val)
 {
-  Lisp_Object args[3], msg;
+  Lisp_Object msg;
   int i;
   struct gcpro gcpro1;
 
@@ -5416,10 +5416,10 @@
 
   ring_bell (XFRAME (selected_frame));
 
-  args[0] = build_string ("Auto-saving %s: %s");
-  args[1] = BVAR (current_buffer, name);
-  args[2] = Ferror_message_string (error_val);
-  msg = Fformat (3, args);
+  msg = Fformat (3, ((Lisp_Object [])
+    { build_local_string ("Auto-saving %s: %s"),
+      BVAR (current_buffer, name),
+      Ferror_message_string (error_val) }));
   GCPRO1 (msg);
 
   for (i = 0; i < 3; ++i)

=== modified file 'src/fns.c'
--- a/src/fns.c 2014-09-15 05:09:44 +0000
+++ b/src/fns.c 2014-09-15 14:53:23 +0000
@@ -2706,7 +2706,6 @@
   (Lisp_Object prompt)
 {
   register Lisp_Object ans;
-  Lisp_Object args[2];
   struct gcpro gcpro1;
 
   CHECK_STRING (prompt);
@@ -2725,10 +2724,8 @@
       return obj;
     }
 
-  args[0] = prompt;
-  args[1] = build_string ("(yes or no) ");
-  prompt = Fconcat (2, args);
-
+  prompt = Fconcat (2, ((Lisp_Object [])
+    { prompt, build_local_string ("(yes or no) ") }));
   GCPRO1 (prompt);
 
   while (1)

=== modified file 'src/font.c'
--- a/src/font.c        2014-09-13 04:41:54 +0000
+++ b/src/font.c        2014-09-15 14:53:23 +0000
@@ -1190,12 +1190,12 @@
        {
          val = prop[XLFD_ENCODING_INDEX];
          if (! NILP (val))
-           val = concat2 (build_string ("*-"), SYMBOL_NAME (val));
+           val = concat2 (build_local_string ("*-"), SYMBOL_NAME (val));
        }
       else if (NILP (prop[XLFD_ENCODING_INDEX]))
-       val = concat2 (SYMBOL_NAME (val), build_string ("-*"));
+       val = concat2 (SYMBOL_NAME (val), build_local_string ("-*"));
       else
-       val = concat3 (SYMBOL_NAME (val), build_string ("-"),
+       val = concat3 (SYMBOL_NAME (val), build_local_string ("-"),
                       SYMBOL_NAME (prop[XLFD_ENCODING_INDEX]));
       if (! NILP (val))
        ASET (font, FONT_REGISTRY_INDEX, Fintern (val, Qnil));
@@ -1793,9 +1793,9 @@
       if (! p1)
        {
          if (SDATA (registry)[len - 1] == '*')
-           registry = concat2 (registry, build_string ("-*"));
+           registry = concat2 (registry, build_local_string ("-*"));
          else
-           registry = concat2 (registry, build_string ("*-*"));
+           registry = concat2 (registry, build_local_string ("*-*"));
        }
       registry = Fdowncase (registry);
       ASET (font_spec, FONT_REGISTRY_INDEX, Fintern (registry, Qnil));
@@ -5022,7 +5022,7 @@
   if (FONTP (arg))
     {
       Lisp_Object tail, elt;
-      Lisp_Object equalstr = build_string ("=");
+      Lisp_Object equalstr = build_local_string ("=");
 
       val = Ffont_xlfd_name (arg, Qt);
       for (tail = AREF (arg, FONT_EXTRA_INDEX); CONSP (tail);
@@ -5056,7 +5056,7 @@
       val = Ffont_xlfd_name (result, Qt);
       if (! FONT_SPEC_P (result))
        val = concat3 (SYMBOL_NAME (AREF (result, FONT_TYPE_INDEX)),
-                      build_string (":"), val);
+                      build_local_string (":"), val);
       result = val;
     }
   else if (CONSP (result))

=== modified file 'src/fontset.c'
--- a/src/fontset.c     2014-09-07 07:04:01 +0000
+++ b/src/fontset.c     2014-09-15 14:53:23 +0000
@@ -1462,7 +1462,7 @@
       registry = AREF (font_spec, FONT_REGISTRY_INDEX);
       if (! NILP (registry))
        registry = Fdowncase (SYMBOL_NAME (registry));
-      encoding = find_font_encoding (concat3 (family, build_string ("-"),
+      encoding = find_font_encoding (concat3 (family, build_local_string ("-"),
                                              registry));
       if (NILP (encoding))
        encoding = Qascii;

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2014-09-07 22:27:59 +0000
+++ b/src/keyboard.c    2014-09-15 14:53:23 +0000
@@ -566,14 +566,14 @@
       if (XINT (last_char) == '-' && XINT (prev_char) != ' ')
        Faset (echo_string, idx, make_number (' '));
       else
-       echo_string = concat2 (echo_string, build_string (" "));
+       echo_string = concat2 (echo_string, build_local_string (" "));
     }
   else if (STRINGP (echo_string) && SCHARS (echo_string) > 0)
-    echo_string = concat2 (echo_string, build_string (" "));
+    echo_string = concat2 (echo_string, build_local_string (" "));
 
   kset_echo_string
     (current_kboard,
-     concat2 (echo_string, make_string (buffer, ptr - buffer)));
+     concat2 (echo_string, make_local_string (buffer, ptr - buffer)));
   SAFE_FREE ();
 }
 
@@ -632,7 +632,7 @@
      but make it go away when the next character is added.  */
   kset_echo_string
     (current_kboard,
-     concat2 (KVAR (current_kboard, echo_string), build_string ("-")));
+     concat2 (KVAR (current_kboard, echo_string), build_local_string ("-")));
   echo_now ();
 }
 
@@ -7883,7 +7883,8 @@
     /* The previous code preferred :key-sequence to :keys, so we
        preserve this behavior.  */
     if (STRINGP (keyeq) && !CONSP (keyhint))
-      keyeq = concat2 (build_string ("  "), Fsubstitute_command_keys (keyeq));
+      keyeq = concat2 (build_local_string ("  "),
+                      Fsubstitute_command_keys (keyeq));
     else
       {
        Lisp_Object prefix = keyeq;
@@ -7926,8 +7927,7 @@
                if (STRINGP (XCDR (prefix)))
                  tem = concat2 (tem, XCDR (prefix));
              }
-           keyeq = concat2 (build_string ("  "), tem);
-           /* keyeq = concat3(build_string("  ("),tem,build_string(")")); */
+           keyeq = concat2 (build_local_string ("  "), tem);
          }
        else
          keyeq = Qnil;
@@ -8632,9 +8632,9 @@
                      Lisp_Object selected
                        = AREF (item_properties, ITEM_PROPERTY_SELECTED);
                      if (EQ (tem, QCradio))
-                       tem = build_string (NILP (selected) ? "(*) " : "( ) ");
+                       tem = build_local_string (NILP (selected) ? "(*) " : "( 
) ");
                      else
-                       tem = build_string (NILP (selected) ? "[X] " : "[ ] ");
+                       tem = build_local_string (NILP (selected) ? "[X] " : "[ 
] ");
                      s = concat2 (tem, s);
                    }
 

=== modified file 'src/keymap.c'
--- a/src/keymap.c      2014-09-07 07:04:01 +0000
+++ b/src/keymap.c      2014-09-15 14:53:23 +0000
@@ -1342,7 +1342,7 @@
       *p = 0;
 
       c = reorder_modifiers (c);
-      keystring = concat2 (build_string (new_mods), XCDR (assoc));
+      keystring = concat2 (build_local_string (new_mods), XCDR (assoc));
 
       error ("To bind the key %s, use [?%s], not [%s]",
             SDATA (SYMBOL_NAME (c)), SDATA (keystring),
@@ -2245,7 +2245,7 @@
   if (CONSP (key) && INTEGERP (XCAR (key)) && INTEGERP (XCDR (key)))
     /* An interval from a map-char-table.  */
     return concat3 (Fsingle_key_description (XCAR (key), no_angles),
-                   build_string (".."),
+                   build_local_string (".."),
                    Fsingle_key_description (XCDR (key), no_angles));
 
   key = EVENT_HEAD (key);
@@ -3444,7 +3444,7 @@
        {
          Lisp_Object tem;
          tem = Fkey_description (prefix, Qnil);
-         elt_prefix = concat2 (tem, build_string (" "));
+         elt_prefix = concat2 (tem, build_local_string (" "));
        }
       prefix = Qnil;
     }

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2014-09-11 09:14:45 +0000
+++ b/src/lisp.h        2014-09-15 14:53:23 +0000
@@ -4605,6 +4605,20 @@
 
 # define USE_LOCAL_ALLOCATORS
 
+/* Return a function-scoped cons whose car is X and cdr is Y.  */
+
+# define local_cons(x, y)                                              \
+    ({                                                                 \
+       struct Lisp_Cons *c = alloca (sizeof (struct Lisp_Cons));       \
+       c->car = (x);                                                   \
+       c->u.cdr = (y);                                                 \
+       make_lisp_ptr (c, Lisp_Cons);                                   \
+    })
+
+# define local_list1(x) local_cons (x, Qnil)
+# define local_list2(x, y) local_cons (x, local_list1 (y))
+# define local_list3(x, y, z) local_cons (x, local_list2 (y, z))
+
 /* Return a function-scoped vector of length SIZE, with each element
    being INIT.  */
 
@@ -4643,12 +4657,17 @@
 
 /* Return a function-scoped string with contents DATA.  */
 
-# define build_local_string(data) \
-    ({ char const *data_ = data; make_local_string (data_, strlen (data_)); })
+# define build_local_string(data)                      \
+    ({ char const *data1_ = (data);                    \
+       make_local_string (data1_, strlen (data1_)); })
 
 #else
 
 /* Safer but slower implementations.  */
+# define local_cons(car, cdr) Fcons (car, cdr)
+# define local_list1(x) list1 (x)
+# define local_list2(x, y) list2 (x, y)
+# define local_list3(x, y, z) list3 (x, y, z)
 # define make_local_vector(size, init) Fmake_vector (make_number (size), init)
 # define make_local_string(data, nbytes) make_string (data, nbytes)
 # define build_local_string(data) build_string (data)

=== modified file 'src/lread.c'
--- a/src/lread.c       2014-09-11 13:02:09 +0000
+++ b/src/lread.c       2014-09-15 14:53:23 +0000
@@ -2894,7 +2894,7 @@
                      Lisp_Object placeholder;
                      Lisp_Object cell;
 
-                     placeholder = Fcons (Qnil, Qnil);
+                     placeholder = scoped_cons (Qnil, Qnil);
                      cell = Fcons (make_number (n), placeholder);
                      read_objects = Fcons (cell, read_objects);
 
@@ -3374,7 +3374,7 @@
           substitute_in_interval contains part of the logic.  */
 
        INTERVAL root_interval = string_intervals (subtree);
-       Lisp_Object arg = Fcons (object, placeholder);
+       Lisp_Object arg = scoped_cons (object, placeholder);
 
        traverse_intervals_noorder (root_interval,
                                    &substitute_in_interval, arg);
@@ -3681,8 +3681,8 @@
               in the installed Lisp directory.
               We don't use Fexpand_file_name because that would make
               the directory absolute now.  */
-           elt = concat2 (build_string ("../lisp/"),
-                        Ffile_name_nondirectory (elt));
+           elt = concat2 (build_local_string ("../lisp/"),
+                          Ffile_name_nondirectory (elt));
        }
       else if (EQ (elt, Vload_file_name)
               && ! NILP (elt)

=== modified file 'src/menu.c'
--- a/src/menu.c        2014-09-07 07:04:01 +0000
+++ b/src/menu.c        2014-09-15 14:53:23 +0000
@@ -390,7 +390,7 @@
                      if (!submenu && SREF (tem, 0) != '\0'
                          && SREF (tem, 0) != '-')
                        ASET (menu_items, idx + MENU_ITEMS_ITEM_NAME,
-                             concat2 (build_string ("    "), tem));
+                             concat2 (build_local_string ("    "), tem));
                      idx += MENU_ITEMS_ITEM_LENGTH;
                    }
                }
@@ -399,14 +399,14 @@
 
          /* Calculate prefix, if any, for this item.  */
          if (EQ (type, QCtoggle))
-           prefix = build_string (NILP (selected) ? "[ ] " : "[X] ");
+           prefix = build_local_string (NILP (selected) ? "[ ] " : "[X] ");
          else if (EQ (type, QCradio))
-           prefix = build_string (NILP (selected) ? "( ) " : "(*) ");
+           prefix = build_local_string (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 = build_local_string ("    ");
 
       if (!NILP (prefix))
        item_string = concat2 (prefix, item_string);
@@ -416,7 +416,7 @@
        || FRAME_MSDOS_P (XFRAME (Vmenu_updating_frame)))
       && !NILP (map))
     /* Indicate visually that this is a submenu.  */
-    item_string = concat2 (item_string, build_string (" >"));
+    item_string = concat2 (item_string, build_local_string (" >"));
 
   push_menu_item (item_string, enabled, key,
                  AREF (item_properties, ITEM_PROPERTY_DEF),

=== modified file 'src/minibuf.c'
--- a/src/minibuf.c     2014-07-27 13:21:30 +0000
+++ b/src/minibuf.c     2014-09-15 14:53:23 +0000
@@ -1123,7 +1123,7 @@
 function, instead of the usual behavior.  */)
   (Lisp_Object prompt, Lisp_Object def, Lisp_Object require_match)
 {
-  Lisp_Object args[4], result;
+  Lisp_Object result;
   char *s;
   ptrdiff_t len;
   ptrdiff_t count = SPECPDL_INDEX ();
@@ -1157,10 +1157,9 @@
                                              STRING_MULTIBYTE (prompt));
            }
 
-         args[0] = build_string ("%s (default %s): ");
-         args[1] = prompt;
-         args[2] = CONSP (def) ? XCAR (def) : def;
-         prompt = Fformat (3, args);
+         prompt = Fformat (3, ((Lisp_Object [])
+           { build_local_string ("%s (default %s): "),
+             prompt, CONSP (def) ? XCAR (def) : def }));
        }
 
       result = Fcompleting_read (prompt, intern ("internal-complete-buffer"),
@@ -1168,13 +1167,8 @@
                                 Qbuffer_name_history, def, Qnil);
     }
   else
-    {
-      args[0] = Vread_buffer_function;
-      args[1] = prompt;
-      args[2] = def;
-      args[3] = require_match;
-      result = Ffuncall (4, args);
-    }
+    result = Ffuncall (4, ((Lisp_Object [])
+      { Vread_buffer_function, prompt, def, require_match }));
   return unbind_to (count, result);
 }
 

=== modified file 'src/process.c'
--- a/src/process.c     2014-09-07 07:04:01 +0000
+++ b/src/process.c     2014-09-15 14:53:23 +0000
@@ -620,7 +620,7 @@
          if (c1 != c2)
            Faset (string, make_number (0), make_number (c2));
        }
-      string2 = build_string (coredump ? " (core dumped)\n" : "\n");
+      string2 = build_local_string (coredump ? " (core dumped)\n" : "\n");
       return concat2 (string, string2);
     }
   else if (EQ (symbol, Qexit))
@@ -630,14 +630,14 @@
       if (code == 0)
        return build_string ("finished\n");
       string = Fnumber_to_string (make_number (code));
-      string2 = build_string (coredump ? " (core dumped)\n" : "\n");
-      return concat3 (build_string ("exited abnormally with code "),
+      string2 = build_local_string (coredump ? " (core dumped)\n" : "\n");
+      return concat3 (build_local_string ("exited abnormally with code "),
                      string, string2);
     }
   else if (EQ (symbol, Qfailed))
     {
       string = Fnumber_to_string (make_number (code));
-      string2 = build_string ("\n");
+      string2 = build_local_string ("\n");
       return concat3 (build_string ("failed with code "),
                      string, string2);
     }
@@ -1305,22 +1305,22 @@
 
       if (size == 4 || (size == 5 && !NILP (omit_port)))
        {
-         args[0] = build_string ("%d.%d.%d.%d");
+         args[0] = build_local_string ("%d.%d.%d.%d");
          nargs = 4;
        }
       else if (size == 5)
        {
-         args[0] = build_string ("%d.%d.%d.%d:%d");
+         args[0] = build_local_string ("%d.%d.%d.%d:%d");
          nargs = 5;
        }
       else if (size == 8 || (size == 9 && !NILP (omit_port)))
        {
-         args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
+         args[0] = build_local_string ("%x:%x:%x:%x:%x:%x:%x:%x");
          nargs = 8;
        }
       else if (size == 9)
        {
-         args[0] = build_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d");
+         args[0] = build_local_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d");
          nargs = 9;
        }
       else
@@ -1339,16 +1339,12 @@
          args[i+1] = p->contents[i];
        }
 
-      return Fformat (nargs+1, args);
+      return Fformat (nargs + 1, args);
     }
 
   if (CONSP (address))
-    {
-      Lisp_Object args[2];
-      args[0] = build_string ("<Family %d>");
-      args[1] = Fcar (address);
-      return Fformat (2, args);
-    }
+    return Fformat (2, ((Lisp_Object [])
+      { build_local_string ("<Family %d>"), Fcar (address) }));
 
   return Qnil;
 }
@@ -4061,20 +4057,14 @@
     {
     case AF_INET:
       {
-       Lisp_Object args[5];
        unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr;
-       args[0] = build_string ("%d.%d.%d.%d");
-       args[1] = make_number (*ip++);
-       args[2] = make_number (*ip++);
-       args[3] = make_number (*ip++);
-       args[4] = make_number (*ip++);
-       host = Fformat (5, args);
+
+       host = Fformat (5, ((Lisp_Object [])
+         { build_local_string ("%d.%d.%d.%d"), make_number (*ip++),
+           make_number (*ip++), make_number (*ip++), make_number (*ip++) }));
        service = make_number (ntohs (saddr.in.sin_port));
-
-       args[0] = build_string (" <%s:%d>");
-       args[1] = host;
-       args[2] = service;
-       caller = Fformat (3, args);
+       caller = Fformat (3, ((Lisp_Object [])
+         { build_local_string (" <%s:%d>"), host, service }));
       }
       break;
 
@@ -4084,16 +4074,14 @@
        Lisp_Object args[9];
        uint16_t *ip6 = (uint16_t *)&saddr.in6.sin6_addr;
        int i;
-       args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
+
+       args[0] = build_local_string ("%x:%x:%x:%x:%x:%x:%x:%x");
        for (i = 0; i < 8; i++)
-         args[i+1] = make_number (ntohs (ip6[i]));
+         args[i + 1] = make_number (ntohs (ip6[i]));
        host = Fformat (9, args);
        service = make_number (ntohs (saddr.in.sin_port));
-
-       args[0] = build_string (" <[%s]:%d>");
-       args[1] = host;
-       args[2] = service;
-       caller = Fformat (3, args);
+       caller = Fformat (3, ((Lisp_Object [])
+         { build_local_string (" <[%s]:%d>"), host, service }));
       }
       break;
 #endif
@@ -4103,7 +4091,8 @@
 #endif
     default:
       caller = Fnumber_to_string (make_number (connect_counter));
-      caller = concat3 (build_string (" <"), caller, build_string (">"));
+      caller = concat3
+       (build_local_string (" <"), caller, build_local_string (">"));
       break;
     }
 
@@ -4202,14 +4191,14 @@
 
   if (!NILP (ps->log))
       call3 (ps->log, server, proc,
-            concat3 (build_string ("accept from "),
-                     (STRINGP (host) ? host : build_string ("-")),
-                     build_string ("\n")));
+            concat3 (build_local_string ("accept from "),
+                     (STRINGP (host) ? host : build_local_string ("-")),
+                     build_local_string ("\n")));
 
   exec_sentinel (proc,
-                concat3 (build_string ("open from "),
-                         (STRINGP (host) ? host : build_string ("-")),
-                         build_string ("\n")));
+                concat3 (build_local_string ("open from "),
+                         (STRINGP (host) ? host : build_local_string ("-")),
+                         build_local_string ("\n")));
 }
 
 /* This variable is different from waiting_for_input in keyboard.c.

=== modified file 'src/textprop.c'
--- a/src/textprop.c    2014-09-07 07:04:01 +0000
+++ b/src/textprop.c    2014-09-15 14:53:23 +0000
@@ -1317,9 +1317,10 @@
 If the optional fifth argument OBJECT is a buffer (or nil, which means
 the current buffer), START and END are buffer positions (integers or
 markers).  If OBJECT is a string, START and END are 0-based indices into it.  
*/)
-  (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object 
value, Lisp_Object object)
+  (Lisp_Object start, Lisp_Object end, Lisp_Object property,
+   Lisp_Object value, Lisp_Object object)
 {
-  Fadd_text_properties (start, end, list2 (property, value), object);
+  Fadd_text_properties (start, end, scoped_list2 (property, value), object);
   return Qnil;
 }
 
@@ -1360,7 +1361,7 @@
   (Lisp_Object start, Lisp_Object end, Lisp_Object face,
    Lisp_Object append, Lisp_Object object)
 {
-  add_text_properties_1 (start, end, list2 (Qface, face), object,
+  add_text_properties_1 (start, end, scoped_list2 (Qface, face), object,
                         (NILP (append)
                          ? TEXT_PROPERTY_PREPEND
                          : TEXT_PROPERTY_APPEND));
@@ -1909,7 +1910,8 @@
 /* Note this can GC when DEST is a buffer.  */
 
 Lisp_Object
-copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, 
Lisp_Object pos, Lisp_Object dest, Lisp_Object prop)
+copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src,
+                     Lisp_Object pos, Lisp_Object dest, Lisp_Object prop)
 {
   INTERVAL i;
   Lisp_Object res;
@@ -1962,12 +1964,11 @@
            plist = Fcdr (Fcdr (plist));
          }
       if (! NILP (plist))
-       {
-         /* Must defer modifications to the interval tree in case src
-            and dest refer to the same string or buffer.  */
-         stuff = Fcons (list3 (make_number (p), make_number (p + len), plist),
-                        stuff);
-       }
+       /* Must defer modifications to the interval tree in case
+          src and dest refer to the same string or buffer.  */
+       stuff = local_cons
+         (local_list3 (make_number (p), make_number (p + len), plist),
+          stuff);
 
       i = next_interval (i);
       if (!i)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]