summaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2012-08-05 19:47:28 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2012-08-05 19:47:28 +0400
commit663e2b3f88f9be61399e06dfc0b76700f90c6ca6 (patch)
tree71e48dfc0079f80f2089b5bdebe991a200d594ed /src/alloc.c
parent777fe95e05ab77e77e4ecee45382ec64d381c776 (diff)
downloademacs-663e2b3f88f9be61399e06dfc0b76700f90c6ca6.tar.gz
emacs-663e2b3f88f9be61399e06dfc0b76700f90c6ca6.tar.bz2
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;
/* Default value of gc_cons_threshold (see below). */
-#define GC_DEFAULT_THRESHOLD (100000 * sizeof (Lisp_Object))
+#define GC_DEFAULT_THRESHOLD (100000 * word_size)
/* Global variables. */
struct emacs_globals globals;
@@ -278,14 +278,6 @@ static void sweep_strings (void);
static void free_misc (Lisp_Object);
extern Lisp_Object which_symbols (Lisp_Object, EMACS_INT) EXTERNALLY_VISIBLE;
-/* Handy constants for vectorlike objects. */
-enum
- {
- header_size = offsetof (struct Lisp_Vector, contents),
- bool_header_size = offsetof (struct Lisp_Bool_Vector, data),
- word_size = sizeof (Lisp_Object)
- };
-
/* When scanning the C stack for live Lisp objects, Emacs keeps track
of what memory allocated via lisp_malloc is intended for what
purpose. This enumeration specifies the type of memory. */
@@ -2810,9 +2802,9 @@ listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...)
Lisp_Object val, *objp;
/* Change to SAFE_ALLOCA if you hit this eassert. */
- eassert (count <= MAX_ALLOCA / sizeof (Lisp_Object));
+ eassert (count <= MAX_ALLOCA / word_size);
- objp = alloca (count * sizeof (Lisp_Object));
+ objp = alloca (count * word_size);
objp[0] = arg;
va_start (ap, arg);
for (i = 1; i < count; i++)