]> code.delx.au - gnu-emacs/commitdiff
* lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 29 Apr 2011 17:56:27 +0000 (10:56 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 29 Apr 2011 17:56:27 +0000 (10:56 -0700)
(EMACS_UINTPTR): Likewise, with uintptr_t.

src/ChangeLog
src/alloc.c
src/doc.c
src/gtkutil.c
src/lisp.h
src/menu.c
src/xdisp.c
src/xmenu.c

index a9fc541b481c51d22ae0ac00c2508d03b9f8fc70..a2bf1fe39cfe12125d39e66158172306ecf26a29 100644 (file)
@@ -1,5 +1,8 @@
 2011-04-29  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * lisp.h (EMACS_INTPTR): Remove.  All uses changed to intptr_t.
+       (EMACS_UINTPTR): Likewise, with uintptr_t.
+
        * lisp.h: Prefer 64-bit EMACS_INT if available.
        (EMACS_INT, EMACS_UINT, BITS_PER_EMACS_INT, pI): Define to 64-bit
        on 32-bit hosts that have 64-bit int, so that they can access
index 591d8264295a1e5bef22522daa41c31a24f2bd1b..0bce83bfae7b7c7739dbebd5b3dfabdbed9a891e 100644 (file)
@@ -438,7 +438,7 @@ static POINTER_TYPE *pure_alloc (size_t, int);
    ALIGNMENT must be a power of 2.  */
 
 #define ALIGN(ptr, ALIGNMENT) \
-  ((POINTER_TYPE *) ((((EMACS_UINTPTR) (ptr)) + (ALIGNMENT) - 1) \
+  ((POINTER_TYPE *) ((((uintptr_t) (ptr)) + (ALIGNMENT) - 1) \
                     & ~((ALIGNMENT) - 1)))
 
 
@@ -876,7 +876,7 @@ struct ablocks
 #define ABLOCKS_BYTES (sizeof (struct ablocks) - BLOCK_PADDING)
 
 #define ABLOCK_ABASE(block) \
-  (((EMACS_UINTPTR) (block)->abase) <= (1 + 2 * ABLOCKS_SIZE)  \
+  (((uintptr_t) (block)->abase) <= (1 + 2 * ABLOCKS_SIZE)      \
    ? (struct ablocks *)(block)                                 \
    : (block)->abase)
 
@@ -888,7 +888,7 @@ struct ablocks
 #define ABLOCKS_BASE(abase) (abase)
 #else
 #define ABLOCKS_BASE(abase) \
-  (1 & (EMACS_INTPTR) ABLOCKS_BUSY (abase) ? abase : ((void**)abase)[-1])
+  (1 & (intptr_t) ABLOCKS_BUSY (abase) ? abase : ((void**)abase)[-1])
 #endif
 
 /* The list of free ablock.   */
@@ -914,7 +914,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
   if (!free_ablock)
     {
       int i;
-      EMACS_INTPTR aligned; /* int gets warning casting to 64-bit pointer.  */
+      intptr_t aligned; /* int gets warning casting to 64-bit pointer.  */
 
 #ifdef DOUG_LEA_MALLOC
       /* Prevent mmap'ing the chunk.  Lisp data may not be mmap'ed
@@ -979,16 +979,16 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
        }
       ABLOCKS_BUSY (abase) = (struct ablocks *) aligned;
 
-      eassert (0 == ((EMACS_UINTPTR) abase) % BLOCK_ALIGN);
+      eassert (0 == ((uintptr_t) abase) % BLOCK_ALIGN);
       eassert (ABLOCK_ABASE (&abase->blocks[3]) == abase); /* 3 is arbitrary */
       eassert (ABLOCK_ABASE (&abase->blocks[0]) == abase);
       eassert (ABLOCKS_BASE (abase) == base);
-      eassert (aligned == (EMACS_INTPTR) ABLOCKS_BUSY (abase));
+      eassert (aligned == (intptr_t) ABLOCKS_BUSY (abase));
     }
 
   abase = ABLOCK_ABASE (free_ablock);
   ABLOCKS_BUSY (abase) =
-    (struct ablocks *) (2 + (EMACS_INTPTR) ABLOCKS_BUSY (abase));
+    (struct ablocks *) (2 + (intptr_t) ABLOCKS_BUSY (abase));
   val = free_ablock;
   free_ablock = free_ablock->x.next_free;
 
@@ -1001,7 +1001,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
   if (!val && nbytes)
     memory_full ();
 
-  eassert (0 == ((EMACS_UINTPTR) val) % BLOCK_ALIGN);
+  eassert (0 == ((uintptr_t) val) % BLOCK_ALIGN);
   return val;
 }
 
@@ -1020,11 +1020,11 @@ lisp_align_free (POINTER_TYPE *block)
   free_ablock = ablock;
   /* Update busy count.  */
   ABLOCKS_BUSY (abase) =
-    (struct ablocks *) (-2 + (EMACS_INTPTR) ABLOCKS_BUSY (abase));
+    (struct ablocks *) (-2 + (intptr_t) ABLOCKS_BUSY (abase));
 
-  if (2 > (EMACS_INTPTR) ABLOCKS_BUSY (abase))
+  if (2 > (intptr_t) ABLOCKS_BUSY (abase))
     { /* All the blocks are free.  */
-      int i = 0, aligned = (EMACS_INTPTR) ABLOCKS_BUSY (abase);
+      int i = 0, aligned = (intptr_t) ABLOCKS_BUSY (abase);
       struct ablock **tem = &free_ablock;
       struct ablock *atop = &abase->blocks[aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1];
 
@@ -1041,7 +1041,7 @@ lisp_align_free (POINTER_TYPE *block)
       eassert ((aligned & 1) == aligned);
       eassert (i == (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1));
 #ifdef USE_POSIX_MEMALIGN
-      eassert ((EMACS_UINTPTR) ABLOCKS_BASE (abase) % BLOCK_ALIGN == 0);
+      eassert ((uintptr_t) ABLOCKS_BASE (abase) % BLOCK_ALIGN == 0);
 #endif
       free (ABLOCKS_BASE (abase));
     }
@@ -1774,7 +1774,7 @@ check_string_free_list (void)
   s = string_free_list;
   while (s != NULL)
     {
-      if ((EMACS_UINTPTR) s < 1024)
+      if ((uintptr_t) s < 1024)
        abort();
       s = NEXT_FREE_LISP_STRING (s);
     }
@@ -2434,10 +2434,10 @@ make_uninit_multibyte_string (EMACS_INT nchars, EMACS_INT nbytes)
   &= ~(1 << ((n) % (sizeof(int) * CHAR_BIT)))
 
 #define FLOAT_BLOCK(fptr) \
-  ((struct float_block *) (((EMACS_UINTPTR) (fptr)) & ~(BLOCK_ALIGN - 1)))
+  ((struct float_block *) (((uintptr_t) (fptr)) & ~(BLOCK_ALIGN - 1)))
 
 #define FLOAT_INDEX(fptr) \
-  ((((EMACS_UINTPTR) (fptr)) & (BLOCK_ALIGN - 1)) / sizeof (struct Lisp_Float))
+  ((((uintptr_t) (fptr)) & (BLOCK_ALIGN - 1)) / sizeof (struct Lisp_Float))
 
 struct float_block
 {
@@ -2546,10 +2546,10 @@ make_float (double float_value)
    / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1))
 
 #define CONS_BLOCK(fptr) \
-  ((struct cons_block *) ((EMACS_UINTPTR) (fptr) & ~(BLOCK_ALIGN - 1)))
+  ((struct cons_block *) ((uintptr_t) (fptr) & ~(BLOCK_ALIGN - 1)))
 
 #define CONS_INDEX(fptr) \
-  (((EMACS_UINTPTR) (fptr) & (BLOCK_ALIGN - 1)) / sizeof (struct Lisp_Cons))
+  (((uintptr_t) (fptr) & (BLOCK_ALIGN - 1)) / sizeof (struct Lisp_Cons))
 
 struct cons_block
 {
@@ -4023,7 +4023,7 @@ mark_maybe_pointer (void *p)
   struct mem_node *m;
 
   /* Quickly rule out some values which can't point to Lisp data.  */
-  if ((EMACS_INTPTR) p %
+  if ((intptr_t) p %
 #ifdef USE_LSB_TAG
       8 /* USE_LSB_TAG needs Lisp data to be aligned on multiples of 8.  */
 #else
@@ -6074,7 +6074,7 @@ We divide the value by 1024 to make sure it fits in a Lisp integer.  */)
 {
   Lisp_Object end;
 
-  XSETINT (end, (EMACS_INTPTR) (char *) sbrk (0) / 1024);
+  XSETINT (end, (intptr_t) (char *) sbrk (0) / 1024);
 
   return end;
 }
index 740bb26ff08b4241eb9d6fb36eeac4cdf9b20058..d764b66e75e03389f413a828b1f072973b4d2d2b 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -349,10 +349,10 @@ string is passed through `substitute-command-keys'.  */)
        return Qnil;
       /* FIXME: This is not portable, as it assumes that string
         pointers have the top bit clear.  */
-      else if ((EMACS_INTPTR) XSUBR (fun)->doc >= 0)
+      else if ((intptr_t) XSUBR (fun)->doc >= 0)
        doc = build_string (XSUBR (fun)->doc);
       else
-       doc = make_number ((EMACS_INTPTR) XSUBR (fun)->doc);
+       doc = make_number ((intptr_t) XSUBR (fun)->doc);
     }
   else if (COMPILEDP (fun))
     {
@@ -508,7 +508,7 @@ store_function_docstring (Lisp_Object fun, EMACS_INT offset)
   /* Lisp_Subrs have a slot for it.  */
    if (SUBRP (fun))
      {
-       EMACS_INTPTR negative_offset = - offset;
+       intptr_t negative_offset = - offset;
        XSUBR (fun)->doc = (char *) negative_offset;
      }
 
index ff33a3f3c0477d19ba7380777047043d24269e87..6e54006d913c9fa266720e20865160ffb1e0d885 100644 (file)
@@ -3354,7 +3354,7 @@ xg_get_scroll_id_for_window (Display *dpy, Window wid)
 static void
 xg_gtk_scroll_destroy (GtkWidget *widget, gpointer data)
 {
-  int id = (EMACS_INTPTR) data;
+  int id = (intptr_t) data;
   xg_remove_widget_from_map (id);
 }
 
@@ -3375,7 +3375,7 @@ xg_create_scroll_bar (FRAME_PTR f,
 {
   GtkWidget *wscroll;
   GtkWidget *webox;
-  EMACS_INTPTR scroll_id;
+  intptr_t scroll_id;
 #ifdef HAVE_GTK3
   GtkAdjustment *vadj;
 #else
@@ -3662,7 +3662,7 @@ xg_tool_bar_button_cb (GtkWidget *widget,
                        GdkEventButton *event,
                        gpointer user_data)
 {
-  EMACS_INTPTR state = event->state;
+  intptr_t state = event->state;
   gpointer ptr = (gpointer) state;
   g_object_set_data (G_OBJECT (widget), XG_TOOL_BAR_LAST_MODIFIER, ptr);
   return FALSE;
@@ -3677,9 +3677,9 @@ xg_tool_bar_button_cb (GtkWidget *widget,
 static void
 xg_tool_bar_callback (GtkWidget *w, gpointer client_data)
 {
-  EMACS_INTPTR idx = (EMACS_INTPTR) client_data;
+  intptr_t idx = (intptr_t) client_data;
   gpointer gmod = g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_LAST_MODIFIER);
-  EMACS_INTPTR mod = (EMACS_INTPTR) gmod;
+  intptr_t mod = (intptr_t) gmod;
 
   FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA);
   Lisp_Object key, frame;
@@ -3958,7 +3958,7 @@ xg_tool_bar_help_callback (GtkWidget *w,
                            GdkEventCrossing *event,
                            gpointer client_data)
 {
-  EMACS_INTPTR idx = (EMACS_INTPTR) client_data;
+  intptr_t idx = (intptr_t) client_data;
   FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA);
   Lisp_Object help, frame;
 
@@ -4152,7 +4152,7 @@ xg_make_tool_item (FRAME_PTR f,
 
   if (wimage)
     {
-      EMACS_INTPTR ii = i;
+      intptr_t ii = i;
       gpointer gi = (gpointer) ii;
 
       g_signal_connect (G_OBJECT (ti), "create-menu-proxy",
index 3b9778ddc6476afcdc615d40e4164bb50a14c060..41848ebae8ef83c7efb50bed51edd88da162d854 100644 (file)
@@ -64,18 +64,6 @@ extern void check_cons_list (void);
 #endif
 #endif
 
-/* Integers large enough to hold casted pointers without losing info.  */
-#ifdef INTPTR_MAX
-# define EMACS_INTPTR intptr_t
-#else
-# define EMACS_INTPTR EMACS_INT
-#endif
-#ifdef UINTPTR_MAX
-# define EMACS_UINTPTR uintptr_t
-#else
-# define EMACS_UINTPTR EMACS_UINT
-#endif
-
 /* Extra internal type checking?  */
 
 #ifdef ENABLE_CHECKING
@@ -431,10 +419,10 @@ enum pvec_type
 # define make_number(N) (((EMACS_INT) (N)) << GCTYPEBITS)
 #endif
 #define XSET(var, type, ptr)                                           \
-    (eassert (XTYPE ((EMACS_INTPTR) (ptr)) == 0), /* Check alignment.  */ \
-     (var) = (type) | (EMACS_INTPTR) (ptr))
+    (eassert (XTYPE ((intptr_t) (ptr)) == 0), /* Check alignment.  */ \
+     (var) = (type) | (intptr_t) (ptr))
 
-#define XPNTR(a) ((EMACS_INTPTR) ((a) & ~TYPEMASK))
+#define XPNTR(a) ((intptr_t) ((a) & ~TYPEMASK))
 
 #else  /* not USE_LSB_TAG */
 
@@ -468,14 +456,14 @@ enum pvec_type
 
 #define XSET(var, type, ptr)                             \
    ((var) = ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \
-            + ((EMACS_INTPTR) (ptr) & VALMASK)))
+            + ((intptr_t) (ptr) & VALMASK)))
 
 #ifdef DATA_SEG_BITS
 /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
    which were stored in a Lisp_Object */
-#define XPNTR(a) ((EMACS_UINTPTR) (((a) & VALMASK)) | DATA_SEG_BITS))
+#define XPNTR(a) ((uintptr_t) (((a) & VALMASK)) | DATA_SEG_BITS))
 #else
-#define XPNTR(a) ((EMACS_UINTPTR) ((a) & VALMASK))
+#define XPNTR(a) ((uintptr_t) ((a) & VALMASK))
 #endif
 
 #endif /* not USE_LSB_TAG */
@@ -501,7 +489,7 @@ enum pvec_type
 /* Some versions of gcc seem to consider the bitfield width when issuing
    the "cast to pointer from integer of different size" warning, so the
    cast is here to widen the value back to its natural size.  */
-# define XPNTR(v) ((EMACS_INTPTR) (v).s.val << GCTYPEBITS)
+# define XPNTR(v) ((intptr_t) (v).s.val << GCTYPEBITS)
 
 #else  /* !USE_LSB_TAG */
 
@@ -517,9 +505,9 @@ enum pvec_type
 #ifdef DATA_SEG_BITS
 /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
    which were stored in a Lisp_Object */
-#define XPNTR(a) ((EMACS_INTPTR) (XUINT (a) | DATA_SEG_BITS))
+#define XPNTR(a) ((intptr_t) (XUINT (a) | DATA_SEG_BITS))
 #else
-#define XPNTR(a) ((EMACS_INTPTR) XUINT (a))
+#define XPNTR(a) ((intptr_t) XUINT (a))
 #endif
 
 #endif /* !USE_LSB_TAG */
@@ -1837,7 +1825,7 @@ typedef struct {
   } while (0)
 
 /* Cast pointers to this type to compare them.  */
-#define PNTR_COMPARISON_TYPE EMACS_UINTPTR
+#define PNTR_COMPARISON_TYPE uintptr_t
 \f
 /* Define a built-in function for calling from Lisp.
  `lname' should be the name to give the function in Lisp,
index 5162ee083bf291337342bc69b735c16fbadbb8be..7a3edcb6f4f16d3585a6e7e45f93791660f92044 100644 (file)
@@ -800,9 +800,9 @@ digest_single_submenu (int start, int end, int top_level_items)
          if (!NILP (descrip))
            wv->lkey = descrip;
          wv->value = 0;
-         /* The EMACS_INTPTR cast avoids a warning.  There's no problem
+         /* The intptr_t cast avoids a warning.  There's no problem
             as long as pointers have enough bits to hold small integers.  */
-         wv->call_data = (!NILP (def) ? (void *) (EMACS_INTPTR) i : 0);
+         wv->call_data = (!NILP (def) ? (void *) (intptr_t) i : 0);
          wv->enabled = !NILP (enable);
 
          if (NILP (type))
@@ -913,7 +913,7 @@ find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object
          entry = XVECTOR (vector)->contents[i + MENU_ITEMS_ITEM_VALUE];
          /* Treat the pointer as an integer.  There's no problem
             as long as pointers have enough bits to hold small integers.  */
-         if ((EMACS_INTPTR) client_data == i)
+         if ((intptr_t) client_data == i)
            {
              int j;
              struct input_event buf;
index af03a504e86972a148e64d48ffcf3bb2f8298e0c..88353e3792563f01e82615b44fbf683748f889f9 100644 (file)
@@ -8737,7 +8737,7 @@ display_echo_area (struct window *w)
   window_height_changed_p
     = with_echo_area_buffer (w, display_last_displayed_message_p,
                             display_echo_area_1,
-                            (EMACS_INTPTR) w, Qnil, 0, 0);
+                            (intptr_t) w, Qnil, 0, 0);
 
   if (no_message_p)
     echo_area_buffer[i] = Qnil;
@@ -8756,7 +8756,7 @@ display_echo_area (struct window *w)
 static int
 display_echo_area_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4)
 {
-  EMACS_INTPTR i1 = a1;
+  intptr_t i1 = a1;
   struct window *w = (struct window *) i1;
   Lisp_Object window;
   struct text_pos start;
@@ -8799,7 +8799,7 @@ resize_echo_area_exactly (void)
        resize_exactly = Qnil;
 
       resized_p = with_echo_area_buffer (w, 0, resize_mini_window_1,
-                                        (EMACS_INTPTR) w, resize_exactly,
+                                        (intptr_t) w, resize_exactly,
                                         0, 0);
       if (resized_p)
        {
@@ -8820,7 +8820,7 @@ resize_echo_area_exactly (void)
 static int
 resize_mini_window_1 (EMACS_INT a1, Lisp_Object exactly, EMACS_INT a3, EMACS_INT a4)
 {
-  EMACS_INTPTR i1 = a1;
+  intptr_t i1 = a1;
   return resize_mini_window ((struct window *) i1, !NILP (exactly));
 }
 
@@ -8987,7 +8987,7 @@ current_message (void)
   else
     {
       with_echo_area_buffer (0, 0, current_message_1,
-                            (EMACS_INTPTR) &msg, Qnil, 0, 0);
+                            (intptr_t) &msg, Qnil, 0, 0);
       if (NILP (msg))
        echo_area_buffer[0] = Qnil;
     }
@@ -8999,7 +8999,7 @@ current_message (void)
 static int
 current_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4)
 {
-  EMACS_INTPTR i1 = a1;
+  intptr_t i1 = a1;
   Lisp_Object *msg = (Lisp_Object *) i1;
 
   if (Z > BEG)
@@ -9131,7 +9131,7 @@ set_message (const char *s, Lisp_Object string,
        || (STRINGP (string) && STRING_MULTIBYTE (string)));
 
   with_echo_area_buffer (0, -1, set_message_1,
-                        (EMACS_INTPTR) s, string, nbytes, multibyte_p);
+                        (intptr_t) s, string, nbytes, multibyte_p);
   message_buf_print = 0;
   help_echo_showing_p = 0;
 }
@@ -9145,7 +9145,7 @@ set_message (const char *s, Lisp_Object string,
 static int
 set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multibyte_p)
 {
-  EMACS_INTPTR i1 = a1;
+  intptr_t i1 = a1;
   const char *s = (const char *) i1;
   const unsigned char *msg = (const unsigned char *) s;
   Lisp_Object string = a2;
index 54f1fc666ec9972982d5c7888164e6b80ee13139..35ad42970cfa6cb27c02d900a1a0c8dcd0a04110 100644 (file)
@@ -1139,9 +1139,9 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
          wv->help = Qnil;
          /* This prevents lwlib from assuming this
             menu item is really supposed to be empty.  */
-         /* The EMACS_INTPTR cast avoids a warning.
+         /* The intptr_t cast avoids a warning.
             This value just has to be different from small integers.  */
-         wv->call_data = (void *) (EMACS_INTPTR) (-1);
+         wv->call_data = (void *) (intptr_t) (-1);
 
          if (prev_wv)
            prev_wv->next = wv;
@@ -1878,7 +1878,7 @@ dialog_selection_callback (GtkWidget *widget, gpointer client_data)
 {
   /* Treat the pointer as an integer.  There's no problem
      as long as pointers have enough bits to hold small integers.  */
-  if ((EMACS_INTPTR) client_data != -1)
+  if ((intptr_t) client_data != -1)
     menu_item_selection = (Lisp_Object *) client_data;
 
   popup_activated_flag = 0;