emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/src font.c [EMACS_23_1_RC]


From: Kenichi Handa
Subject: [Emacs-diffs] emacs/src font.c [EMACS_23_1_RC]
Date: Fri, 03 Jul 2009 02:00:29 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         EMACS_23_1_RC
Changes by:     Kenichi Handa <handa>   09/07/03 02:00:29

Modified files:
        src            : font.c 

Log message:
        (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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/font.c?cvsroot=emacs&only_with_tag=EMACS_23_1_RC&r1=1.133&r2=1.133.2.1

Patches:
Index: font.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/font.c,v
retrieving revision 1.133
retrieving revision 1.133.2.1
diff -u -b -r1.133 -r1.133.2.1
--- font.c      10 Jun 2009 01:26:15 -0000      1.133
+++ font.c      3 Jul 2009 02:00:28 -0000       1.133.2.1
@@ -2763,6 +2763,33 @@
   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 @@
          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 @@
   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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]