summaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2009-08-25 06:03:09 +0000
committerKenichi Handa <handa@m17n.org>2009-08-25 06:03:09 +0000
commit5802634797b76bc7385716398c52aac9be90c0d0 (patch)
tree98ccd0fd5ab69bfd939ea30a5e19c52d6cc4b385 /src/alloc.c
parentaf62aa887b1a9bc9f94d669a7511d7ba06866269 (diff)
downloademacs-5802634797b76bc7385716398c52aac9be90c0d0.tar.gz
(mark_char_table): New function.
(mark_object): Use mark_char_table for a char-table.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 157d768d69d..d11eff3d387 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5371,6 +5371,34 @@ mark_vectorlike (ptr)
return 1;
}
+/* Like mark_vectorlike but optimized for char-tables (and
+ sub-char-tables) assuming that the contents are mostly integers or
+ symbols. */
+
+static void
+mark_char_table (ptr)
+ struct Lisp_Vector *ptr;
+{
+ register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK;
+ register int i;
+
+ VECTOR_MARK (ptr);
+ for (i = 0; i < size; i++)
+ {
+ Lisp_Object val = ptr->contents[i];
+
+ if (INTEGERP (val) || SYMBOLP (val) && XSYMBOL (val)->gcmarkbit)
+ continue;
+ if (SUB_CHAR_TABLE_P (val))
+ {
+ if (! VECTOR_MARKED_P (XVECTOR (val)))
+ mark_char_table (XVECTOR (val));
+ }
+ else
+ mark_object (val);
+ }
+}
+
void
mark_object (arg)
Lisp_Object arg;
@@ -5533,6 +5561,11 @@ mark_object (arg)
VECTOR_MARK (XVECTOR (h->key_and_value));
}
}
+ else if (CHAR_TABLE_P (obj))
+ {
+ if (! VECTOR_MARKED_P (XVECTOR (obj)))
+ mark_char_table (XVECTOR (obj));
+ }
else
mark_vectorlike (XVECTOR (obj));
break;