aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-08-05 19:47:28 +0400
committerDmitry Antipov2012-08-05 19:47:28 +0400
commit663e2b3f88f9be61399e06dfc0b76700f90c6ca6 (patch)
tree71e48dfc0079f80f2089b5bdebe991a200d594ed /src/alloc.c
parent777fe95e05ab77e77e4ecee45382ec64d381c776 (diff)
downloademacs-663e2b3f88f9be61399e06dfc0b76700f90c6ca6.tar.gz
emacs-663e2b3f88f9be61399e06dfc0b76700f90c6ca6.zip
Generalize common compile-time constants.
* lisp.h (header_size, bool_header_size, word_size): Now here. (struct Lisp_Vector): Add comment. (struct Lisp_Bool_Vector): Move up to define handy constants. (VECSIZE, PSEUDOVECSIZE): Simplify. (SAFE_ALLOCA_LISP): Use new constant. Adjust indentation. * buffer.c, buffer.h, bytecode.c, callint.c, eval.c, fns.c: * font.c, fontset.c, keyboard.c, keymap.c, macros.c, menu.c: * msdos.c, w32menu.c, w32term.h, window.c, xdisp.c, xfaces.c: * xfont.c, xmenu.c: Use word_size where appropriate.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 3939e704978..7d1ff7625f2 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -155,7 +155,7 @@ static pthread_mutex_t alloc_mutex;
155 155
156/* Default value of gc_cons_threshold (see below). */ 156/* Default value of gc_cons_threshold (see below). */
157 157
158#define GC_DEFAULT_THRESHOLD (100000 * sizeof (Lisp_Object)) 158#define GC_DEFAULT_THRESHOLD (100000 * word_size)
159 159
160/* Global variables. */ 160/* Global variables. */
161struct emacs_globals globals; 161struct emacs_globals globals;
@@ -278,14 +278,6 @@ static void sweep_strings (void);
278static void free_misc (Lisp_Object); 278static void free_misc (Lisp_Object);
279extern Lisp_Object which_symbols (Lisp_Object, EMACS_INT) EXTERNALLY_VISIBLE; 279extern Lisp_Object which_symbols (Lisp_Object, EMACS_INT) EXTERNALLY_VISIBLE;
280 280
281/* Handy constants for vectorlike objects. */
282enum
283 {
284 header_size = offsetof (struct Lisp_Vector, contents),
285 bool_header_size = offsetof (struct Lisp_Bool_Vector, data),
286 word_size = sizeof (Lisp_Object)
287 };
288
289/* When scanning the C stack for live Lisp objects, Emacs keeps track 281/* When scanning the C stack for live Lisp objects, Emacs keeps track
290 of what memory allocated via lisp_malloc is intended for what 282 of what memory allocated via lisp_malloc is intended for what
291 purpose. This enumeration specifies the type of memory. */ 283 purpose. This enumeration specifies the type of memory. */
@@ -2810,9 +2802,9 @@ listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...)
2810 Lisp_Object val, *objp; 2802 Lisp_Object val, *objp;
2811 2803
2812 /* Change to SAFE_ALLOCA if you hit this eassert. */ 2804 /* Change to SAFE_ALLOCA if you hit this eassert. */
2813 eassert (count <= MAX_ALLOCA / sizeof (Lisp_Object)); 2805 eassert (count <= MAX_ALLOCA / word_size);
2814 2806
2815 objp = alloca (count * sizeof (Lisp_Object)); 2807 objp = alloca (count * word_size);
2816 objp[0] = arg; 2808 objp[0] = arg;
2817 va_start (ap, arg); 2809 va_start (ap, arg);
2818 for (i = 1; i < count; i++) 2810 for (i = 1; i < count; i++)