emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109449: Generalize common compile-ti


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109449: Generalize common compile-time constants.
Date: Sun, 05 Aug 2012 19:47:28 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109449
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Sun 2012-08-05 19:47:28 +0400
message:
  Generalize common compile-time constants.
  * lisp.h (header_size, bool_header_size, word_size): Now here.
  (struct Lisp_Vector): Add comment.
  (struct Lisp_Bool_Vector): Move up to define handy constants.
  (VECSIZE, PSEUDOVECSIZE): Simplify.
  (SAFE_ALLOCA_LISP): Use new constant.  Adjust indentation.
  * buffer.c, buffer.h, bytecode.c, callint.c, eval.c, fns.c:
  * font.c, fontset.c, keyboard.c, keymap.c, macros.c, menu.c:
  * msdos.c, w32menu.c, w32term.h, window.c, xdisp.c, xfaces.c:
  * xfont.c, xmenu.c: Use word_size where appropriate.
modified:
  src/ChangeLog
  src/alloc.c
  src/buffer.c
  src/buffer.h
  src/bytecode.c
  src/callint.c
  src/eval.c
  src/fns.c
  src/font.c
  src/fontset.c
  src/keyboard.c
  src/keymap.c
  src/lisp.h
  src/macros.c
  src/menu.c
  src/msdos.c
  src/w32menu.c
  src/w32term.h
  src/window.c
  src/xdisp.c
  src/xfaces.c
  src/xfont.c
  src/xmenu.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-05 13:30:15 +0000
+++ b/src/ChangeLog     2012-08-05 15:47:28 +0000
@@ -1,3 +1,16 @@
+2012-08-05  Dmitry Antipov  <address@hidden>
+
+       Generalize common compile-time constants.
+       * lisp.h (header_size, bool_header_size, word_size): Now here.
+       (struct Lisp_Vector): Add comment.
+       (struct Lisp_Bool_Vector): Move up to define handy constants.
+       (VECSIZE, PSEUDOVECSIZE): Simplify.
+       (SAFE_ALLOCA_LISP): Use new constant.  Adjust indentation.
+       * buffer.c, buffer.h, bytecode.c, callint.c, eval.c, fns.c:
+       * font.c, fontset.c, keyboard.c, keymap.c, macros.c, menu.c:
+       * msdos.c, w32menu.c, w32term.h, window.c, xdisp.c, xfaces.c:
+       * xfont.c, xmenu.c: Use word_size where appropriate.
+
 2012-08-05  Lawrence Mitchell  <address@hidden>
 
        * search.c (Freplace_match): Treat \? in the replacement text

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-08-03 23:36:11 +0000
+++ b/src/alloc.c       2012-08-05 15:47:28 +0000
@@ -155,7 +155,7 @@
 
 /* Default value of gc_cons_threshold (see below).  */
 
-#define GC_DEFAULT_THRESHOLD (100000 * sizeof (Lisp_Object))
+#define GC_DEFAULT_THRESHOLD (100000 * word_size)
 
 /* Global variables.  */
 struct emacs_globals globals;
@@ -278,14 +278,6 @@
 static void free_misc (Lisp_Object);
 extern Lisp_Object which_symbols (Lisp_Object, EMACS_INT) EXTERNALLY_VISIBLE;
 
-/* Handy constants for vectorlike objects.  */
-enum
-  {
-    header_size = offsetof (struct Lisp_Vector, contents),
-    bool_header_size = offsetof (struct Lisp_Bool_Vector, data),
-    word_size = sizeof (Lisp_Object)
-  };
-
 /* When scanning the C stack for live Lisp objects, Emacs keeps track
    of what memory allocated via lisp_malloc is intended for what
    purpose.  This enumeration specifies the type of memory.  */
@@ -2810,9 +2802,9 @@
   Lisp_Object val, *objp;
 
   /* Change to SAFE_ALLOCA if you hit this eassert.  */
-  eassert (count <= MAX_ALLOCA / sizeof (Lisp_Object));
+  eassert (count <= MAX_ALLOCA / word_size);
 
-  objp = alloca (count * sizeof (Lisp_Object));
+  objp = alloca (count * word_size);
   objp[0] = arg;
   va_start (ap, arg);
   for (i = 1; i < count; i++)

=== modified file 'src/buffer.c'
--- a/src/buffer.c      2012-08-02 07:31:34 +0000
+++ b/src/buffer.c      2012-08-05 15:47:28 +0000
@@ -99,7 +99,7 @@
 /* Maximum length of an overlay vector.  */
 #define OVERLAY_COUNT_MAX                                              \
   ((ptrdiff_t) min (MOST_POSITIVE_FIXNUM,                              \
-                   min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object)))
+                   min (PTRDIFF_MAX, SIZE_MAX) / word_size))
 
 /* Flags indicating which built-in buffer-local variables
    are permanent locals.  */
@@ -4267,7 +4267,7 @@
     ptrdiff_t i;
 
     memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,
-           size * sizeof (Lisp_Object));
+           size * word_size);
     gcpro1.var = copy;
     gcpro1.nvars = size;
 
@@ -4886,8 +4886,7 @@
      sure that this is still correct.  Otherwise, mark_vectorlike may not
      trace all Lisp_Objects in buffer_defaults and buffer_local_symbols.  */
   const int pvecsize
-    = (offsetof (struct buffer, own_text) - sizeof (struct vectorlike_header))
-    / sizeof (Lisp_Object);
+    = (offsetof (struct buffer, own_text) - header_size) / word_size;
 
   memset (buffer_permanent_local_flags, 0, sizeof 
buffer_permanent_local_flags);
 
@@ -4972,7 +4971,7 @@
      The local flag bits are in the local_var_flags slot of the buffer.  */
 
   /* Nothing can work if this isn't true */
-  { verify (sizeof (EMACS_INT) == sizeof (Lisp_Object)); }
+  { verify (sizeof (EMACS_INT) == word_size); }
 
   /* 0 means not a lisp var, -1 means always local, else mask */
   memset (&buffer_local_flags, 0, sizeof buffer_local_flags);

=== modified file 'src/buffer.h'
--- a/src/buffer.h      2012-08-02 07:31:34 +0000
+++ b/src/buffer.h      2012-08-05 15:47:28 +0000
@@ -1029,7 +1029,7 @@
 #define FOR_EACH_PER_BUFFER_OBJECT_AT(offset)                           \
   for (offset = PER_BUFFER_VAR_OFFSET (name);                           \
        offset <= PER_BUFFER_VAR_OFFSET (cursor_in_non_selected_windows); \
-       offset += sizeof (Lisp_Object))
+       offset += word_size)
 
 /* Return the index of buffer-local variable VAR.  Each per-buffer
    variable has an index > 0 associated with it, except when it always

=== modified file 'src/bytecode.c'
--- a/src/bytecode.c    2012-08-01 07:57:09 +0000
+++ b/src/bytecode.c    2012-08-05 15:47:28 +0000
@@ -536,7 +536,7 @@
   stack.byte_string = bytestr;
   stack.pc = stack.byte_string_start = SDATA (bytestr);
   stack.constants = vector;
-  if (MAX_ALLOCA / sizeof (Lisp_Object) <= XFASTINT (maxdepth))
+  if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth))
     memory_full (SIZE_MAX);
   top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top);
 #if BYTE_MAINTAIN_TOP

=== modified file 'src/callint.c'
--- a/src/callint.c     2012-07-27 09:24:34 +0000
+++ b/src/callint.c     2012-08-05 15:47:28 +0000
@@ -465,7 +465,7 @@
     }
 
   if (min (MOST_POSITIVE_FIXNUM,
-          min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object))
+          min (PTRDIFF_MAX, SIZE_MAX) / word_size)
       < nargs)
     memory_full (SIZE_MAX);
 

=== modified file 'src/eval.c'
--- a/src/eval.c        2012-08-01 07:57:09 +0000
+++ b/src/eval.c        2012-08-05 15:47:28 +0000
@@ -2301,7 +2301,7 @@
       gcpro1.nvars = 1 + numargs;
     }
 
-  memcpy (funcall_args, args, nargs * sizeof (Lisp_Object));
+  memcpy (funcall_args, args, nargs * word_size);
   /* Spread the last arg we got.  Its first element goes in
      the slot that it used to occupy, hence this value of I.  */
   i = nargs - 1;
@@ -2794,7 +2794,7 @@
            {
              internal_args = alloca (XSUBR (fun)->max_args
                                      * sizeof *internal_args);
-             memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object));
+             memcpy (internal_args, args + 1, numargs * word_size);
              for (i = numargs; i < XSUBR (fun)->max_args; i++)
                internal_args[i] = Qnil;
            }

=== modified file 'src/fns.c'
--- a/src/fns.c 2012-08-03 23:36:11 +0000
+++ b/src/fns.c 2012-08-05 15:47:28 +0000
@@ -3569,7 +3569,7 @@
 /* An upper bound on the size of a hash table index.  It must fit in
    ptrdiff_t and be a valid Emacs fixnum.  */
 #define INDEX_SIZE_BOUND \
-  ((ptrdiff_t) min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX / sizeof (Lisp_Object)))
+  ((ptrdiff_t) min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX / word_size))
 
 /* Create and initialize a new hash table.
 

=== modified file 'src/font.c'
--- a/src/font.c        2012-08-03 23:36:11 +0000
+++ b/src/font.c        2012-08-05 15:47:28 +0000
@@ -2138,7 +2138,7 @@
 font_vconcat_entity_vectors (Lisp_Object list)
 {
   int nargs = XINT (Flength (list));
-  Lisp_Object *args = alloca (sizeof (Lisp_Object) * nargs);
+  Lisp_Object *args = alloca (word_size * nargs);
   int i;
 
   for (i = 0; i < nargs; i++, list = XCDR (list))

=== modified file 'src/fontset.c'
--- a/src/fontset.c     2012-08-01 05:11:36 +0000
+++ b/src/fontset.c     2012-08-05 15:47:28 +0000
@@ -429,7 +429,7 @@
     }
 
   if (score_changed)
-    qsort (XVECTOR (vec)->contents, size, sizeof (Lisp_Object),
+    qsort (XVECTOR (vec)->contents, size, word_size,
           fontset_compare_rfontdef);
   XSETCAR (font_group, make_number (charset_ordered_list_tick));
 }
@@ -1893,7 +1893,7 @@
 
   /* Recode fontsets realized on FRAME from the base fontset FONTSET
      in the table `realized'.  */
-  realized[0] = alloca (sizeof (Lisp_Object) * ASIZE (Vfontset_table));
+  realized[0] = alloca (word_size * ASIZE (Vfontset_table));
   for (i = j = 0; i < ASIZE (Vfontset_table); i++)
     {
       elt = FONTSET_FROM_ID (i);
@@ -1904,7 +1904,7 @@
     }
   realized[0][j] = Qnil;
 
-  realized[1] = alloca (sizeof (Lisp_Object) * ASIZE (Vfontset_table));
+  realized[1] = alloca (word_size * ASIZE (Vfontset_table));
   for (i = j = 0; ! NILP (realized[0][i]); i++)
     {
       elt = FONTSET_DEFAULT (realized[0][i]);

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2012-08-03 23:36:11 +0000
+++ b/src/keyboard.c    2012-08-05 15:47:28 +0000
@@ -7527,7 +7527,7 @@
            if (end > i + 4)
              memmove (aref_addr (menu_bar_items_vector, i),
                       aref_addr (menu_bar_items_vector, i + 4),
-                      (end - i - 4) * sizeof (Lisp_Object));
+                      (end - i - 4) * word_size);
            ASET (menu_bar_items_vector, end - 4, tem0);
            ASET (menu_bar_items_vector, end - 3, tem1);
            ASET (menu_bar_items_vector, end - 2, tem2);
@@ -7577,7 +7577,7 @@
            if (menu_bar_items_index > i + 4)
              memmove (aref_addr (menu_bar_items_vector, i),
                       aref_addr (menu_bar_items_vector, i + 4),
-                      (menu_bar_items_index - i - 4) * sizeof (Lisp_Object));
+                      (menu_bar_items_index - i - 4) * word_size);
            menu_bar_items_index -= 4;
          }
     }
@@ -8082,7 +8082,7 @@
              if (ntool_bar_items > i + TOOL_BAR_ITEM_NSLOTS)
                memmove (v, v + TOOL_BAR_ITEM_NSLOTS,
                         ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS)
-                         * sizeof (Lisp_Object)));
+                         * word_size));
              ntool_bar_items -= TOOL_BAR_ITEM_NSLOTS;
              break;
            }
@@ -10425,9 +10425,9 @@
     {
       val = Fvector (NUM_RECENT_KEYS, keys);
       memcpy (XVECTOR (val)->contents, keys + recent_keys_index,
-             (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object));
+             (NUM_RECENT_KEYS - recent_keys_index) * word_size);
       memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
-             keys, recent_keys_index * sizeof (Lisp_Object));
+             keys, recent_keys_index * word_size);
       return val;
     }
 }

=== modified file 'src/keymap.c'
--- a/src/keymap.c      2012-08-03 23:36:11 +0000
+++ b/src/keymap.c      2012-08-05 15:47:28 +0000
@@ -2069,7 +2069,7 @@
     size += XINT (Flength (prefix));
 
   /* This has one extra element at the end that we don't pass to Fconcat.  */
-  if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object) / 4 < size)
+  if (min (PTRDIFF_MAX, SIZE_MAX) / word_size / 4 < size)
     memory_full (SIZE_MAX);
   SAFE_ALLOCA_LISP (args, size * 4);
 

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-08-04 00:52:10 +0000
+++ b/src/lisp.h        2012-08-05 15:47:28 +0000
@@ -824,25 +824,49 @@
     } next;
   };
 
+/* Regular vector is just a header plus array of Lisp_Objects.  */
+
 struct Lisp_Vector
   {
     struct vectorlike_header header;
     Lisp_Object contents[1];
   };
 
+/* A boolvector is a kind of vectorlike, with contents are like a string.  */
+
+struct Lisp_Bool_Vector
+  {
+    /* HEADER.SIZE is the vector's size field.  It doesn't have the real size,
+       just the subtype information.  */
+    struct vectorlike_header header;
+    /* This is the size in bits.  */
+    EMACS_INT size;
+    /* This contains the actual bits, packed into bytes.  */
+    unsigned char data[1];
+  };
+
+/* Some handy constants for calculating sizes
+   and offsets, mostly of vectorlike objects.   */
+
+enum
+  {
+    header_size = offsetof (struct Lisp_Vector, contents),
+    bool_header_size = offsetof (struct Lisp_Bool_Vector, data),
+    word_size = sizeof (Lisp_Object)
+  };
+
 /* If a struct is made to look like a vector, this macro returns the length
    of the shortest vector that would hold that struct.  */
-#define VECSIZE(type) ((sizeof (type)                                    \
-                       - offsetof (struct Lisp_Vector, contents[0])      \
-                        + sizeof (Lisp_Object) - 1) /* Round up.  */     \
-                      / sizeof (Lisp_Object))
+
+#define VECSIZE(type)                                          \
+  ((sizeof (type) - header_size + word_size - 1) / word_size)
 
 /* Like VECSIZE, but used when the pseudo-vector has non-Lisp_Object fields
    at the end and we need to compute the number of Lisp_Object fields (the
    ones that the GC needs to trace).  */
-#define PSEUDOVECSIZE(type, nonlispfield) \
-  ((offsetof (type, nonlispfield) - offsetof (struct Lisp_Vector, 
contents[0])) \
-   / sizeof (Lisp_Object))
+
+#define PSEUDOVECSIZE(type, nonlispfield)                      \
+  ((offsetof (type, nonlispfield) - header_size) / word_size)
 
 /* A char-table is a kind of vectorlike, with contents are like a
    vector but with a few other slots.  For some purposes, it makes
@@ -978,18 +1002,6 @@
     Lisp_Object contents[1];
   };
 
-/* A boolvector is a kind of vectorlike, with contents are like a string.  */
-struct Lisp_Bool_Vector
-  {
-    /* HEADER.SIZE is the vector's size field.  It doesn't have the real size,
-       just the subtype information.  */
-    struct vectorlike_header header;
-    /* This is the size in bits.  */
-    EMACS_INT size;
-    /* This contains the actual bits, packed into bytes.  */
-    unsigned char data[1];
-  };
-
 /* This structure describes a built-in function.
    It is generated by the DEFUN macro only.
    defsubr makes it into a Lisp object.
@@ -3483,21 +3495,21 @@
 
 /* SAFE_ALLOCA_LISP allocates an array of Lisp_Objects.  */
 
-#define SAFE_ALLOCA_LISP(buf, nelt)                      \
-  do {                                                   \
-    if ((nelt) < MAX_ALLOCA / sizeof (Lisp_Object))      \
-      buf = alloca ((nelt) * sizeof (Lisp_Object));      \
-    else if ((nelt) < min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object)) \
-      {                                                          \
-       Lisp_Object arg_;                                 \
-       buf = xmalloc ((nelt) * sizeof (Lisp_Object));    \
-       arg_ = make_save_value (buf, nelt);               \
-       XSAVE_VALUE (arg_)->dogc = 1;                     \
-       sa_must_free = 1;                                 \
-       record_unwind_protect (safe_alloca_unwind, arg_); \
-      }                                                          \
-    else                                                 \
-      memory_full (SIZE_MAX);                            \
+#define SAFE_ALLOCA_LISP(buf, nelt)                           \
+  do {                                                        \
+    if ((nelt) < MAX_ALLOCA / word_size)                      \
+      buf = alloca ((nelt) * word_size);                      \
+    else if ((nelt) < min (PTRDIFF_MAX, SIZE_MAX) / word_size) \
+      {                                                               \
+       Lisp_Object arg_;                                      \
+       buf = xmalloc ((nelt) * word_size);                    \
+       arg_ = make_save_value (buf, nelt);                    \
+       XSAVE_VALUE (arg_)->dogc = 1;                          \
+       sa_must_free = 1;                                      \
+       record_unwind_protect (safe_alloca_unwind, arg_);      \
+      }                                                               \
+    else                                                      \
+      memory_full (SIZE_MAX);                                 \
   } while (0)
 
 

=== modified file 'src/macros.c'
--- a/src/macros.c      2012-08-03 23:36:11 +0000
+++ b/src/macros.c      2012-08-05 15:47:28 +0000
@@ -63,7 +63,7 @@
 
   if (!current_kboard->kbd_macro_buffer)
     {
-      current_kboard->kbd_macro_buffer = xmalloc (30 * sizeof (Lisp_Object));
+      current_kboard->kbd_macro_buffer = xmalloc (30 * word_size);
       current_kboard->kbd_macro_bufsize = 30;
     }
   update_mode_lines++;
@@ -73,7 +73,7 @@
        {
          current_kboard->kbd_macro_buffer
            = xrealloc (current_kboard->kbd_macro_buffer,
-                       30 * sizeof (Lisp_Object));
+                       30 * word_size);
          current_kboard->kbd_macro_bufsize = 30;
        }
       current_kboard->kbd_macro_ptr = current_kboard->kbd_macro_buffer;

=== modified file 'src/menu.c'
--- a/src/menu.c        2012-08-03 23:36:11 +0000
+++ b/src/menu.c        2012-08-05 15:47:28 +0000
@@ -976,7 +976,7 @@
 
   prefix = entry = Qnil;
   i = 0;
-  subprefix_stack = alloca (menu_items_used * sizeof (Lisp_Object));
+  subprefix_stack = alloca (menu_items_used * word_size);
 
   while (i < menu_items_used)
     {

=== modified file 'src/msdos.c'
--- a/src/msdos.c       2012-08-04 08:58:33 +0000
+++ b/src/msdos.c       2012-08-05 15:47:28 +0000
@@ -1594,9 +1594,9 @@
   Lisp_Object tail;
   int i, j, length = XINT (Flength (alist));
   Lisp_Object *parms
-    = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
+    = (Lisp_Object *) alloca (length * word_size);
   Lisp_Object *values
-    = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
+    = (Lisp_Object *) alloca (length * word_size);
   /* Do we have to reverse the foreground and background colors?  */
   int reverse = EQ (Fcdr (Fassq (Qreverse, FVAR (f, param_alist))), Qt);
   int redraw = 0, fg_set = 0, bg_set = 0;
@@ -2435,9 +2435,9 @@
     {
       val = Fvector (NUM_RECENT_DOSKEYS, keys);
       memcpy (XVECTOR (val)->contents, keys + recent_doskeys_index,
-             (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof 
(Lisp_Object));
+             (NUM_RECENT_DOSKEYS - recent_doskeys_index) * word_size);
       memcpy (XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - 
recent_doskeys_index,
-             keys, recent_doskeys_index * sizeof (Lisp_Object));
+             keys, recent_doskeys_index * word_size);
       return val;
     }
 }

=== modified file 'src/w32menu.c'
--- a/src/w32menu.c     2012-08-03 23:36:11 +0000
+++ b/src/w32menu.c     2012-08-05 15:47:28 +0000
@@ -276,7 +276,7 @@
   if (!f)
     return;
   entry = Qnil;
-  subprefix_stack = (Lisp_Object *) alloca (f->menu_bar_items_used * sizeof 
(Lisp_Object));
+  subprefix_stack = (Lisp_Object *) alloca (f->menu_bar_items_used * 
word_size);
   vector = FVAR (f, menu_bar_vector);
   prefix = Qnil;
   i = 0;
@@ -387,7 +387,7 @@
       int previous_menu_items_used = f->menu_bar_items_used;
       Lisp_Object *previous_items
        = (Lisp_Object *) alloca (previous_menu_items_used
-                                 * sizeof (Lisp_Object));
+                                 * word_size);
 
       /* If we are making a new widget, its contents are empty,
         do always reinitialize them.  */
@@ -420,7 +420,7 @@
       /* Save the frame's previous menu bar contents data.  */
       if (previous_menu_items_used)
        memcpy (previous_items, XVECTOR (FVAR (f, menu_bar_vector))->contents,
-               previous_menu_items_used * sizeof (Lisp_Object));
+               previous_menu_items_used * word_size);
 
       /* Fill in menu_items with the current menu bar contents.
         This can evaluate Lisp code.  */
@@ -665,7 +665,7 @@
   widget_value **submenu_stack
     = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
   Lisp_Object *subprefix_stack
-    = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object));
+    = (Lisp_Object *) alloca (menu_items_used * word_size);
   int submenu_depth = 0;
   int first_pane;
 

=== modified file 'src/w32term.h'
--- a/src/w32term.h     2012-07-30 17:07:33 +0000
+++ b/src/w32term.h     2012-08-05 15:47:28 +0000
@@ -429,7 +429,7 @@
 #define SCROLL_BAR_VEC_SIZE                                    \
   ((sizeof (struct scroll_bar)                                 \
     - sizeof (EMACS_INT) - sizeof (struct Lisp_Vector *))      \
-   / sizeof (Lisp_Object))
+   / word_size)
 
 /* Turning a lisp vector value into a pointer to a struct scroll_bar.  */
 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))

=== modified file 'src/window.c'
--- a/src/window.c      2012-08-01 05:11:36 +0000
+++ b/src/window.c      2012-08-05 15:47:28 +0000
@@ -3263,7 +3263,7 @@
   p = allocate_window ();
   memcpy ((char *) p + sizeof (struct vectorlike_header),
          (char *) o + sizeof (struct vectorlike_header),
-         sizeof (Lisp_Object) * VECSIZE (struct window));
+         word_size * VECSIZE (struct window));
   XSETWINDOW (parent, p);
 
   p->sequence_number = ++sequence_number;

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2012-08-03 23:36:11 +0000
+++ b/src/xdisp.c       2012-08-05 15:47:28 +0000
@@ -2420,7 +2420,7 @@
       ptrdiff_t i;
       ptrdiff_t count = SPECPDL_INDEX ();
       struct gcpro gcpro1;
-      Lisp_Object *args = alloca (nargs * sizeof (Lisp_Object));
+      Lisp_Object *args = alloca (nargs * word_size);
 
       args[0] = func;
       va_start (ap, func);

=== modified file 'src/xfaces.c'
--- a/src/xfaces.c      2012-08-03 23:36:11 +0000
+++ b/src/xfaces.c      2012-08-05 15:47:28 +0000
@@ -1657,7 +1657,7 @@
   vec = Fvconcat (ndrivers, drivers);
   nfonts = ASIZE (vec);
 
-  qsort (XVECTOR (vec)->contents, nfonts, sizeof (Lisp_Object),
+  qsort (XVECTOR (vec)->contents, nfonts, word_size,
         compare_fonts_by_sort_order);
 
   result = Qnil;
@@ -2768,7 +2768,7 @@
     }
 
   memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents,
-         LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
+         LFACE_VECTOR_SIZE * word_size);
 
   /* Changing a named face means that all realized faces depending on
      that face are invalid.  Since we cannot tell which realized faces

=== modified file 'src/xfont.c'
--- a/src/xfont.c       2012-08-03 23:36:11 +0000
+++ b/src/xfont.c       2012-08-05 15:47:28 +0000
@@ -464,11 +464,11 @@
              continue;
            }
          if (memcmp (props, aref_addr (entity, FONT_FOUNDRY_INDEX),
-                     sizeof (Lisp_Object) * 7)
+                     word_size * 7)
              || ! EQ (AREF (entity, FONT_SPACING_INDEX), props[7]))
            {
              memcpy (props, aref_addr (entity, FONT_FOUNDRY_INDEX),
-                     sizeof (Lisp_Object) * 7);
+                     word_size * 7);
              props[7] = AREF (entity, FONT_SPACING_INDEX);
              scripts = xfont_supported_scripts (display, indices[i],
                                                 xfont_scratch_props, encoding);

=== modified file 'src/xmenu.c'
--- a/src/xmenu.c       2012-08-01 20:51:44 +0000
+++ b/src/xmenu.c       2012-08-05 15:47:28 +0000
@@ -1015,7 +1015,7 @@
       /* Save the frame's previous menu bar contents data.  */
       if (previous_menu_items_used)
        memcpy (previous_items, XVECTOR (FVAR (f, menu_bar_vector))->contents,
-               previous_menu_items_used * sizeof (Lisp_Object));
+               previous_menu_items_used * word_size);
 
       /* Fill in menu_items with the current menu bar contents.
         This can evaluate Lisp code.  */


reply via email to

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