emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/src category.c


From: Kenichi Handa
Subject: [Emacs-diffs] emacs/src category.c
Date: Thu, 27 Nov 2008 07:59:21 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kenichi Handa <handa>   08/11/27 07:59:21

Modified files:
        src            : category.c 

Log message:
        (hash_get_category_set): New function.
        (Fmodify_category_entry): Adjusted for the change of
        char_table_ref_and_range.  Call hash_get_category_set to get a
        category set to store in the table.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/category.c?cvsroot=emacs&r1=1.50&r2=1.51

Patches:
Index: category.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/category.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- category.c  28 Oct 2008 22:12:32 -0000      1.50
+++ category.c  27 Nov 2008 07:59:21 -0000      1.51
@@ -58,6 +58,32 @@
 
 /* Category set staff.  */
 
+static Lisp_Object hash_get_category_set P_ ((Lisp_Object, Lisp_Object));
+
+static Lisp_Object
+hash_get_category_set (table, category_set)
+     Lisp_Object table, category_set;
+{
+  Lisp_Object val;
+  struct Lisp_Hash_Table *h;
+  int i;
+  unsigned hash;
+
+  if (NILP (XCHAR_TABLE (table)->extras[1]))
+    XCHAR_TABLE (table)->extras[1]
+      = make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE),
+                        make_float (DEFAULT_REHASH_SIZE),
+                        make_float (DEFAULT_REHASH_THRESHOLD),
+                        Qnil, Qnil, Qnil);
+  h = XHASH_TABLE (XCHAR_TABLE (table)->extras[1]);
+  i = hash_lookup (h, category_set, &hash);
+  if (i >= 0)
+    return HASH_KEY (h, i);
+  hash_put (h, category_set, Qnil, hash);
+  return category_set;
+}
+
+
 DEFUN ("make-category-set", Fmake_category_set, Smake_category_set, 1, 1, 0,
        doc: /* Return a newly created category-set which contains CATEGORIES.
 CATEGORIES is a string of category mnemonics.
@@ -370,14 +396,13 @@
 
   while (start <= end)
     {
+      from = start, to = end;
       category_set = char_table_ref_and_range (table, start, &from, &to);
       if (CATEGORY_MEMBER (XFASTINT (category), category_set) != NILP (reset))
        {
          category_set = Fcopy_sequence (category_set);
          SET_CATEGORY_SET (category_set, category, set_value);
-         if (to > end)
-           char_table_set_range (table, start, end, category_set);
-         else
+         category_set = hash_get_category_set (table, category_set);
            char_table_set_range (table, start, to, category_set);
        }
       start = to + 1;




reply via email to

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