aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-02-28 13:27:38 +0000
committerGerd Moellmann2001-02-28 13:27:38 +0000
commitb3660ef6056820452b1d58a1f250b7650ff3d5b5 (patch)
tree291df3126f6434275c14cd07090b709fb775de66 /src
parent42cc5ba46326b2462a1ed42df41e8dcd96ee2c77 (diff)
downloademacs-b3660ef6056820452b1d58a1f250b7650ff3d5b5.tar.gz
emacs-b3660ef6056820452b1d58a1f250b7650ff3d5b5.zip
(Fdelete, larger_vector): Use allocate_vector.
(make_hash_table, copy_hash_table): Use allocate_hash_table.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/fns.c b/src/fns.c
index 29498de417e..cb3ed14a3a8 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1618,13 +1618,12 @@ to be sure of changing the value of `foo'.")
1618 1618
1619 if (n != ASIZE (seq)) 1619 if (n != ASIZE (seq))
1620 { 1620 {
1621 struct Lisp_Vector *p = allocate_vectorlike (n); 1621 struct Lisp_Vector *p = allocate_vector (n);
1622 1622
1623 for (i = n = 0; i < ASIZE (seq); ++i) 1623 for (i = n = 0; i < ASIZE (seq); ++i)
1624 if (NILP (Fequal (AREF (seq, i), elt))) 1624 if (NILP (Fequal (AREF (seq, i), elt)))
1625 p->contents[n++] = AREF (seq, i); 1625 p->contents[n++] = AREF (seq, i);
1626 1626
1627 p->size = n;
1628 XSETVECTOR (seq, p); 1627 XSETVECTOR (seq, p);
1629 } 1628 }
1630 } 1629 }
@@ -3824,8 +3823,7 @@ larger_vector (vec, new_size, init)
3824 old_size = XVECTOR (vec)->size; 3823 old_size = XVECTOR (vec)->size;
3825 xassert (new_size >= old_size); 3824 xassert (new_size >= old_size);
3826 3825
3827 v = allocate_vectorlike (new_size); 3826 v = allocate_vector (new_size);
3828 v->size = new_size;
3829 bcopy (XVECTOR (vec)->contents, v->contents, 3827 bcopy (XVECTOR (vec)->contents, v->contents,
3830 old_size * sizeof *v->contents); 3828 old_size * sizeof *v->contents);
3831 for (i = old_size; i < new_size; ++i) 3829 for (i = old_size; i < new_size; ++i)
@@ -3994,9 +3992,8 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak,
3994 Lisp_Object user_test, user_hash; 3992 Lisp_Object user_test, user_hash;
3995{ 3993{
3996 struct Lisp_Hash_Table *h; 3994 struct Lisp_Hash_Table *h;
3997 struct Lisp_Vector *v;
3998 Lisp_Object table; 3995 Lisp_Object table;
3999 int index_size, i, len, sz; 3996 int index_size, i, sz;
4000 3997
4001 /* Preconditions. */ 3998 /* Preconditions. */
4002 xassert (SYMBOLP (test)); 3999 xassert (SYMBOLP (test));
@@ -4010,16 +4007,11 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak,
4010 if (XFASTINT (size) == 0) 4007 if (XFASTINT (size) == 0)
4011 size = make_number (1); 4008 size = make_number (1);
4012 4009
4013 /* Allocate a vector, and initialize it. */ 4010 /* Allocate a table and initialize it. */
4014 len = VECSIZE (struct Lisp_Hash_Table); 4011 h = allocate_hash_table ();
4015 v = allocate_vectorlike (len);
4016 v->size = len;
4017 for (i = 0; i < len; ++i)
4018 v->contents[i] = Qnil;
4019 4012
4020 /* Initialize hash table slots. */ 4013 /* Initialize hash table slots. */
4021 sz = XFASTINT (size); 4014 sz = XFASTINT (size);
4022 h = (struct Lisp_Hash_Table *) v;
4023 4015
4024 h->test = test; 4016 h->test = test;
4025 if (EQ (test, Qeql)) 4017 if (EQ (test, Qeql))
@@ -4088,11 +4080,8 @@ copy_hash_table (h1)
4088 Lisp_Object table; 4080 Lisp_Object table;
4089 struct Lisp_Hash_Table *h2; 4081 struct Lisp_Hash_Table *h2;
4090 struct Lisp_Vector *v, *next; 4082 struct Lisp_Vector *v, *next;
4091 int len;
4092 4083
4093 len = VECSIZE (struct Lisp_Hash_Table); 4084 h2 = allocate_hash_table ();
4094 v = allocate_vectorlike (len);
4095 h2 = (struct Lisp_Hash_Table *) v;
4096 next = h2->vec_next; 4085 next = h2->vec_next;
4097 bcopy (h1, h2, sizeof *h2); 4086 bcopy (h1, h2, sizeof *h2);
4098 h2->vec_next = next; 4087 h2->vec_next = next;