summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2009-07-03 02:00:28 +0000
committerKenichi Handa <handa@m17n.org>2009-07-03 02:00:28 +0000
commit7f9491df69d961393171b40d143b35cacc96fcb0 (patch)
tree1f785d52480084c0bc13174f9da340062ff19afc
parent654e2858c19fbdafbba19f0928beefa5ec51130e (diff)
downloademacs-7f9491df69d961393171b40d143b35cacc96fcb0.tar.gz
(font_entity_vector_cache): New variable.
(syms_of_font): Initialize it. (font_concat_entities): New function. (font_list_entities): Use font_concat_entities instead of Fvconcat.
-rw-r--r--src/font.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/font.c b/src/font.c
index bc21fce3859..6c2311cf236 100644
--- a/src/font.c
+++ b/src/font.c
@@ -2763,6 +2763,33 @@ font_delete_unmatched (list, spec, size)
return Fnreverse (val);
}
+static Lisp_Object font_entity_vector_cache;
+
+/* Concatenate lists of font-entities in VEC_ENTITY_LIST or length LEN. */
+
+static Lisp_Object
+font_concat_entities (Lisp_Object *vec_entity_list, int len)
+{
+ int i, j, num;
+ Lisp_Object vec, tail;
+
+ for (i = 0, num = 0; i < len; i++)
+ num += XINT (Flength (vec_entity_list[i]));
+ vec = Fgethash (make_number (num), font_entity_vector_cache, Qnil);
+ if (NILP (vec))
+ {
+ vec = Fvconcat (len, vec_entity_list);
+ Fputhash (make_number (num), vec, font_entity_vector_cache);
+ }
+ else
+ {
+ for (i = 0, j = 0; i < len; i++)
+ for (tail = vec_entity_list[i]; CONSP (tail); tail = XCDR (tail), j++)
+ ASET (vec, j, XCAR (tail));
+ }
+ return vec;
+}
+
/* Return a vector of font-entities matching with SPEC on FRAME. */
@@ -2831,7 +2858,7 @@ font_list_entities (frame, spec)
vec[i++] = val;
}
- val = (i > 0 ? Fvconcat (i, vec) : null_vector);
+ val = (i > 0 ? font_concat_entities (vec, i) : null_vector);
font_add_log ("list", spec, val);
return (val);
}
@@ -5178,6 +5205,14 @@ syms_of_font ()
staticpro (&Vfont_log_deferred);
Vfont_log_deferred = Fmake_vector (make_number (3), Qnil);
+ staticpro (&font_entity_vector_cache);
+ { /* Here we rely on the fact that syms_of_font is called fairly
+ late, when QCweakness is known to be set. */
+ Lisp_Object args[2];
+ args[0] = QCweakness;
+ args[1] = Qt;
+ font_entity_vector_cache = Fmake_hash_table (2, args);
+ }
#if 0
#ifdef HAVE_LIBOTF
staticpro (&otf_list);