emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109095: Use zero_vector where approp


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109095: Use zero_vector where appropriate.
Date: Sun, 15 Jul 2012 11:57:54 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109095
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Sun 2012-07-15 11:57:54 +0400
message:
  Use zero_vector where appropriate.
  * alloc.c (zero_vector): Define as Lisp_Object.  Adjust users
  accordingly.
  * lisp.h (zero_vector): New declaration.
  * font.c (null_vector): Remove.
  (syms_of_font): Remove initialization and staticpro.
  (font_list_entities, font_find_for_lface): Change to use zero_vector.
  * keymap.c (Faccessible_keymaps): Likewise.
modified:
  src/ChangeLog
  src/alloc.c
  src/font.c
  src/keymap.c
  src/lisp.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-15 00:52:16 +0000
+++ b/src/ChangeLog     2012-07-15 07:57:54 +0000
@@ -1,3 +1,14 @@
+2012-07-15  Dmitry Antipov  <address@hidden>
+
+       Use zero_vector where appropriate.
+       * alloc.c (zero_vector): Define as Lisp_Object.  Adjust users
+       accordingly.
+       * lisp.h (zero_vector): New declaration.
+       * font.c (null_vector): Remove.
+       (syms_of_font): Remove initialization and staticpro.
+       (font_list_entities, font_find_for_lface): Change to use zero_vector.
+       * keymap.c (Faccessible_keymaps): Likewise.
+
 2012-07-15  Leo Liu  <address@hidden>
 
        * fringe.c: Fix typo in comments.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-07-11 06:14:27 +0000
+++ b/src/alloc.c       2012-07-15 07:57:54 +0000
@@ -2973,7 +2973,7 @@
 
 /* The only vector with 0 slots, allocated from pure space.  */
 
-static struct Lisp_Vector *zero_vector;
+Lisp_Object zero_vector;
 
 /* Get a new vector block.  */
 
@@ -2997,8 +2997,7 @@
 static void
 init_vectors (void)
 {
-  zero_vector = pure_alloc (header_size, Lisp_Vectorlike);
-  zero_vector->header.size = 0;
+  zero_vector = make_pure_vector (0);
 }
 
 /* Allocate vector from a vector block.  */
@@ -3190,7 +3189,7 @@
   /* eassert (!handling_signal); */
 
   if (len == 0)
-    p = zero_vector;
+    p = XVECTOR (zero_vector);
   else
     {
       size_t nbytes = header_size + len * word_size;

=== modified file 'src/font.c'
--- a/src/font.c        2012-07-11 07:37:39 +0000
+++ b/src/font.c        2012-07-15 07:57:54 +0000
@@ -59,10 +59,6 @@
 /* Unicode category `Cf'.  */
 static Lisp_Object QCf;
 
-/* Special vector of zero length.  This is repeatedly used by (struct
-   font_driver *)->list when a specified font is not found. */
-static Lisp_Object null_vector;
-
 /* Vector of Vfont_weight_table, Vfont_slant_table, and Vfont_width_table. */
 static Lisp_Object font_style_table;
 
@@ -2748,7 +2744,7 @@
 
            val = driver_list->driver->list (frame, scratch_font_spec);
            if (NILP (val))
-             val = null_vector;
+             val = zero_vector;
            else
              val = Fvconcat (1, &val);
            copy = copy_font_spec (scratch_font_spec);
@@ -3104,10 +3100,10 @@
     {
       registry[0] = DEFAULT_ENCODING;
       registry[1] = Qascii_0;
-      registry[2] = null_vector;
+      registry[2] = zero_vector;
     }
   else
-    registry[1] = null_vector;
+    registry[1] = zero_vector;
 
   if (c >= 0 && ! NILP (AREF (spec, FONT_REGISTRY_INDEX)))
     {
@@ -3136,20 +3132,20 @@
   ASET (work, FONT_SIZE_INDEX, Qnil);
   foundry[0] = AREF (work, FONT_FOUNDRY_INDEX);
   if (! NILP (foundry[0]))
-    foundry[1] = null_vector;
+    foundry[1] = zero_vector;
   else if (STRINGP (attrs[LFACE_FOUNDRY_INDEX]))
     {
       val = attrs[LFACE_FOUNDRY_INDEX];
       foundry[0] = font_intern_prop (SSDATA (val), SBYTES (val), 1);
       foundry[1] = Qnil;
-      foundry[2] = null_vector;
+      foundry[2] = zero_vector;
     }
   else
-    foundry[0] = Qnil, foundry[1] = null_vector;
+    foundry[0] = Qnil, foundry[1] = zero_vector;
 
   adstyle[0] = AREF (work, FONT_ADSTYLE_INDEX);
   if (! NILP (adstyle[0]))
-    adstyle[1] = null_vector;
+    adstyle[1] = zero_vector;
   else if (FONTP (attrs[LFACE_FONT_INDEX]))
     {
       Lisp_Object face_font = attrs[LFACE_FONT_INDEX];
@@ -3158,13 +3154,13 @@
        {
          adstyle[0] = AREF (face_font, FONT_ADSTYLE_INDEX);
          adstyle[1] = Qnil;
-         adstyle[2] = null_vector;
+         adstyle[2] = zero_vector;
        }
       else
-       adstyle[0] = Qnil, adstyle[1] = null_vector;
+       adstyle[0] = Qnil, adstyle[1] = zero_vector;
     }
   else
-    adstyle[0] = Qnil, adstyle[1] = null_vector;
+    adstyle[0] = Qnil, adstyle[1] = zero_vector;
 
 
   val = AREF (work, FONT_FAMILY_INDEX);
@@ -3177,7 +3173,7 @@
     {
       family = alloca ((sizeof family[0]) * 2);
       family[0] = Qnil;
-      family[1] = null_vector; /* terminator.  */
+      family[1] = zero_vector; /* terminator.  */
     }
   else
     {
@@ -3192,7 +3188,7 @@
            family[i] = XCAR (alters);
          if (NILP (AREF (spec, FONT_FAMILY_INDEX)))
            family[i++] = Qnil;
-         family[i] = null_vector;
+         family[i] = zero_vector;
        }
       else
        {
@@ -3201,7 +3197,7 @@
          family[i++] = val;
          if (NILP (AREF (spec, FONT_FAMILY_INDEX)))
            family[i++] = Qnil;
-         family[i] = null_vector;
+         family[i] = zero_vector;
        }
     }
 
@@ -5095,9 +5091,6 @@
 
   DEFSYM (QCuser_spec, "user-spec");
 
-  staticpro (&null_vector);
-  null_vector = Fmake_vector (make_number (0), Qnil);
-
   staticpro (&scratch_font_spec);
   scratch_font_spec = Ffont_spec (0, NULL);
   staticpro (&scratch_font_prefer);

=== modified file 'src/keymap.c'
--- a/src/keymap.c      2012-07-10 08:43:46 +0000
+++ b/src/keymap.c      2012-07-15 07:57:54 +0000
@@ -2010,9 +2010,7 @@
        return Qnil;
     }
   else
-    maps = Fcons (Fcons (Fmake_vector (make_number (0), Qnil),
-                        get_keymap (keymap, 1, 0)),
-                 Qnil);
+    maps = Fcons (Fcons (zero_vector, get_keymap (keymap, 1, 0)), Qnil);
 
   /* For each map in the list maps,
      look at any other maps it points to,

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-07-12 23:56:39 +0000
+++ b/src/lisp.h        2012-07-15 07:57:54 +0000
@@ -2605,6 +2605,7 @@
 extern void refill_memory_reserve (void);
 #endif
 extern const char *pending_malloc_warning;
+extern Lisp_Object zero_vector;
 extern Lisp_Object *stack_base;
 extern Lisp_Object list1 (Lisp_Object);
 extern Lisp_Object list2 (Lisp_Object, Lisp_Object);


reply via email to

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