]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify lisp.h by removing the __COUNTER__ business.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 10 Sep 2014 20:56:05 +0000 (13:56 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 10 Sep 2014 20:56:05 +0000 (13:56 -0700)
Problem reported by Dmitry Antipov in:
http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00220.html
* lisp.h (make_local_vector, make_local_string)
(build_local_string): Simplify by not bothering with __COUNTER__.
The __COUNTER__ business wasn't working properly, and was needed
only for hypothetical future expansion anyway.

src/ChangeLog
src/lisp.h

index 5498a07a0dac2b9caba08205c0da866fadecb5e9..50f5fb8ca1ee074bfed4bd800b6f8d8c47852d65 100644 (file)
@@ -1,3 +1,13 @@
+2014-09-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Simplify lisp.h by removing the __COUNTER__ business.
+       Problem reported by Dmitry Antipov in:
+       http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00220.html
+       * lisp.h (make_local_vector, make_local_string)
+       (build_local_string): Simplify by not bothering with __COUNTER__.
+       The __COUNTER__ business wasn't working properly, and was needed
+       only for hypothetical future expansion anyway.
+
 2014-09-10  Alp Aker  <alp.tekin.aker@gmail.com>
 
        * nsterm.m (ns_draw_fringe_bitmap): Use the same logic as other
index 1415ab270bcd0a22282cde0ee260b9997e130eb9..468e8f9fa1c8e6ce5cfc4fd452ef3c8a0ebc2a02 100644 (file)
@@ -4563,58 +4563,50 @@ verify (sizeof (struct Lisp_Cons) == sizeof (union Aligned_Cons));
 # define scoped_list3(x, y, z) list3 (x, y, z)
 #endif
 
-#if USE_STACK_LISP_OBJECTS && HAVE_STATEMENT_EXPRESSIONS && defined __COUNTER__
+#if USE_STACK_LISP_OBJECTS && HAVE_STATEMENT_EXPRESSIONS
 
 # define USE_LOCAL_ALLOCATORS
 
 /* Return a function-scoped vector of length SIZE, with each element
    being INIT.  */
 
-# define make_local_vector(size, init) \
-    make_local_vector_n (size, init, __COUNTER__)
-# define make_local_vector_n(size_arg, init_arg, n)                    \
+# define make_local_vector(size, init)                                 \
     ({                                                                 \
-       ptrdiff_t size##n = size_arg;                                   \
-       Lisp_Object init##n = init_arg;                                 \
-       Lisp_Object vec##n;                                             \
-       if (size##n <= (MAX_ALLOCA - header_size) / word_size)          \
+       ptrdiff_t size_ = size;                                         \
+       Lisp_Object init_ = init;                                       \
+       Lisp_Object vec_;                                               \
+       if (size_ <= (MAX_ALLOCA - header_size) / word_size)            \
         {                                                              \
-          void *ptr##n = alloca (size##n * word_size + header_size);   \
-          vec##n = local_vector_init (ptr##n, size##n, init##n);       \
+          void *ptr_ = alloca (size_ * word_size + header_size);       \
+          vec_ = local_vector_init (ptr_, size_, init_);               \
         }                                                              \
        else                                                            \
-        vec##n = Fmake_vector (make_number (size##n), init##n);        \
-       vec##n;                                                         \
+        vec_ = Fmake_vector (make_number (size_), init_);              \
+       vec_;                                                           \
     })
 
 /* Return a function-scoped string with contents DATA and length NBYTES.  */
 
-# define make_local_string(data, nbytes) \
-    make_local_string (data, nbytes, __COUNTER__)
-# define make_local_string_n(data_arg, nbytes_arg, n)                  \
+# define make_local_string(data, nbytes)                               \
     ({                                                                 \
-       char const *data##n = data_arg;                                 \
-       ptrdiff_t nbytes##n = nbytes_arg;                               \
-       Lisp_Object string##n;                                          \
-       if (nbytes##n <= MAX_ALLOCA - sizeof (struct Lisp_String) - 1)  \
+       char const *data_ = data;                                       \
+       ptrdiff_t nbytes_ = nbytes;                                     \
+       Lisp_Object string_;                                            \
+       if (nbytes_ <= MAX_ALLOCA - sizeof (struct Lisp_String) - 1)    \
         {                                                              \
-          struct Lisp_String *ptr##n                                   \
-            = alloca (sizeof (struct Lisp_String) + 1 + nbytes);       \
-          string##n = local_string_init (ptr##n, data##n, nbytes##n);  \
+          struct Lisp_String *ptr_ = alloca (sizeof (struct Lisp_String) + 1 \
+                                             + nbytes_);               \
+          string_ = local_string_init (ptr_, data_, nbytes_);          \
         }                                                              \
        else                                                            \
-        string##n = make_string (data##n, nbytes##n);                  \
-       string##n;                                                      \
+        string_ = make_string (data_, nbytes_);                        \
+       string_;                                                                \
     })
 
 /* Return a function-scoped string with contents DATA.  */
 
-# define build_local_string(data) build_local_string_n (data, __COUNTER__)
-# define build_local_string_n(data_arg, n)                     \
-    ({                                                         \
-       char const *data##n = data_arg;                         \
-       make_local_string (data##n, strlen (data##n));          \
-    })
+# define build_local_string(data) \
+    ({ char const *data_ = data; make_local_string (data_, strlen (data_)); })
 
 #else