changeset 9968:943a61c764a5

(Fmake_vector): Call allocate_vectorlike. (allocate_vectorlike): New function, extracted from Fmake_vector.
author Karl Heuer <kwzh@gnu.org>
date Wed, 16 Nov 1994 04:48:37 +0000
parents 620611070d29
children 007d93b04e1f
files src/alloc.c
diffstat 1 files changed, 22 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/alloc.c	Wed Nov 16 03:42:44 1994 +0000
+++ b/src/alloc.c	Wed Nov 16 04:48:37 1994 +0000
@@ -583,32 +583,43 @@
 
 struct Lisp_Vector *all_vectors;
 
+struct Lisp_Vector *
+allocate_vectorlike (len)
+     EMACS_INT len;
+{
+  struct Lisp_Vector *p;
+
+  p = (struct Lisp_Vector *)xmalloc (sizeof (struct Lisp_Vector)
+				     + (len - 1) * sizeof (Lisp_Object));
+  VALIDATE_LISP_STORAGE (p, 0);
+  consing_since_gc += (sizeof (struct Lisp_Vector)
+		       + (len - 1) * sizeof (Lisp_Object));
+
+  p->next = all_vectors;
+  all_vectors = p;
+  return p;
+}
+
 DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0,
   "Return a newly created vector of length LENGTH, with each element being INIT.\n\
 See also the function `vector'.")
   (length, init)
      register Lisp_Object length, init;
 {
-  register int sizei, index;
-  register Lisp_Object vector;
+  Lisp_Object vector;
+  register EMACS_INT sizei;
+  register int index;
   register struct Lisp_Vector *p;
 
   CHECK_NATNUM (length, 0);
   sizei = XFASTINT (length);
 
-  p = (struct Lisp_Vector *) xmalloc (sizeof (struct Lisp_Vector) + (sizei - 1) * sizeof (Lisp_Object));
-  VALIDATE_LISP_STORAGE (p, 0);
-
-  XSETVECTOR (vector, p);
-  consing_since_gc += sizeof (struct Lisp_Vector) + (sizei - 1) * sizeof (Lisp_Object);
-
+  p = allocate_vectorlike (sizei);
   p->size = sizei;
-  p->next = all_vectors;
-  all_vectors = p;
-
   for (index = 0; index < sizei; index++)
     p->contents[index] = init;
 
+  XSETVECTOR (vector, p);
   return vector;
 }