aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2011-04-29 10:56:27 -0700
committerPaul Eggert2011-04-29 10:56:27 -0700
commitd01a78266d12561b46777a2156914d12d8099c4f (patch)
tree3fa5ec64d44faeca79a6fe89b88362cda723fdff /src/alloc.c
parent7fd47d5ce2020a22f8db9776e8d1f47891b966dc (diff)
downloademacs-d01a78266d12561b46777a2156914d12d8099c4f.tar.gz
emacs-d01a78266d12561b46777a2156914d12d8099c4f.zip
* lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t.
(EMACS_UINTPTR): Likewise, with uintptr_t.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 591d8264295..0bce83bfae7 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -438,7 +438,7 @@ static POINTER_TYPE *pure_alloc (size_t, int);
438 ALIGNMENT must be a power of 2. */ 438 ALIGNMENT must be a power of 2. */
439 439
440#define ALIGN(ptr, ALIGNMENT) \ 440#define ALIGN(ptr, ALIGNMENT) \
441 ((POINTER_TYPE *) ((((EMACS_UINTPTR) (ptr)) + (ALIGNMENT) - 1) \ 441 ((POINTER_TYPE *) ((((uintptr_t) (ptr)) + (ALIGNMENT) - 1) \
442 & ~((ALIGNMENT) - 1))) 442 & ~((ALIGNMENT) - 1)))
443 443
444 444
@@ -876,7 +876,7 @@ struct ablocks
876#define ABLOCKS_BYTES (sizeof (struct ablocks) - BLOCK_PADDING) 876#define ABLOCKS_BYTES (sizeof (struct ablocks) - BLOCK_PADDING)
877 877
878#define ABLOCK_ABASE(block) \ 878#define ABLOCK_ABASE(block) \
879 (((EMACS_UINTPTR) (block)->abase) <= (1 + 2 * ABLOCKS_SIZE) \ 879 (((uintptr_t) (block)->abase) <= (1 + 2 * ABLOCKS_SIZE) \
880 ? (struct ablocks *)(block) \ 880 ? (struct ablocks *)(block) \
881 : (block)->abase) 881 : (block)->abase)
882 882
@@ -888,7 +888,7 @@ struct ablocks
888#define ABLOCKS_BASE(abase) (abase) 888#define ABLOCKS_BASE(abase) (abase)
889#else 889#else
890#define ABLOCKS_BASE(abase) \ 890#define ABLOCKS_BASE(abase) \
891 (1 & (EMACS_INTPTR) ABLOCKS_BUSY (abase) ? abase : ((void**)abase)[-1]) 891 (1 & (intptr_t) ABLOCKS_BUSY (abase) ? abase : ((void**)abase)[-1])
892#endif 892#endif
893 893
894/* The list of free ablock. */ 894/* The list of free ablock. */
@@ -914,7 +914,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
914 if (!free_ablock) 914 if (!free_ablock)
915 { 915 {
916 int i; 916 int i;
917 EMACS_INTPTR aligned; /* int gets warning casting to 64-bit pointer. */ 917 intptr_t aligned; /* int gets warning casting to 64-bit pointer. */
918 918
919#ifdef DOUG_LEA_MALLOC 919#ifdef DOUG_LEA_MALLOC
920 /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed 920 /* 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)
979 } 979 }
980 ABLOCKS_BUSY (abase) = (struct ablocks *) aligned; 980 ABLOCKS_BUSY (abase) = (struct ablocks *) aligned;
981 981
982 eassert (0 == ((EMACS_UINTPTR) abase) % BLOCK_ALIGN); 982 eassert (0 == ((uintptr_t) abase) % BLOCK_ALIGN);
983 eassert (ABLOCK_ABASE (&abase->blocks[3]) == abase); /* 3 is arbitrary */ 983 eassert (ABLOCK_ABASE (&abase->blocks[3]) == abase); /* 3 is arbitrary */
984 eassert (ABLOCK_ABASE (&abase->blocks[0]) == abase); 984 eassert (ABLOCK_ABASE (&abase->blocks[0]) == abase);
985 eassert (ABLOCKS_BASE (abase) == base); 985 eassert (ABLOCKS_BASE (abase) == base);
986 eassert (aligned == (EMACS_INTPTR) ABLOCKS_BUSY (abase)); 986 eassert (aligned == (intptr_t) ABLOCKS_BUSY (abase));
987 } 987 }
988 988
989 abase = ABLOCK_ABASE (free_ablock); 989 abase = ABLOCK_ABASE (free_ablock);
990 ABLOCKS_BUSY (abase) = 990 ABLOCKS_BUSY (abase) =
991 (struct ablocks *) (2 + (EMACS_INTPTR) ABLOCKS_BUSY (abase)); 991 (struct ablocks *) (2 + (intptr_t) ABLOCKS_BUSY (abase));
992 val = free_ablock; 992 val = free_ablock;
993 free_ablock = free_ablock->x.next_free; 993 free_ablock = free_ablock->x.next_free;
994 994
@@ -1001,7 +1001,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
1001 if (!val && nbytes) 1001 if (!val && nbytes)
1002 memory_full (); 1002 memory_full ();
1003 1003
1004 eassert (0 == ((EMACS_UINTPTR) val) % BLOCK_ALIGN); 1004 eassert (0 == ((uintptr_t) val) % BLOCK_ALIGN);
1005 return val; 1005 return val;
1006} 1006}
1007 1007
@@ -1020,11 +1020,11 @@ lisp_align_free (POINTER_TYPE *block)
1020 free_ablock = ablock; 1020 free_ablock = ablock;
1021 /* Update busy count. */ 1021 /* Update busy count. */
1022 ABLOCKS_BUSY (abase) = 1022 ABLOCKS_BUSY (abase) =
1023 (struct ablocks *) (-2 + (EMACS_INTPTR) ABLOCKS_BUSY (abase)); 1023 (struct ablocks *) (-2 + (intptr_t) ABLOCKS_BUSY (abase));
1024 1024
1025 if (2 > (EMACS_INTPTR) ABLOCKS_BUSY (abase)) 1025 if (2 > (intptr_t) ABLOCKS_BUSY (abase))
1026 { /* All the blocks are free. */ 1026 { /* All the blocks are free. */
1027 int i = 0, aligned = (EMACS_INTPTR) ABLOCKS_BUSY (abase); 1027 int i = 0, aligned = (intptr_t) ABLOCKS_BUSY (abase);
1028 struct ablock **tem = &free_ablock; 1028 struct ablock **tem = &free_ablock;
1029 struct ablock *atop = &abase->blocks[aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1]; 1029 struct ablock *atop = &abase->blocks[aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1];
1030 1030
@@ -1041,7 +1041,7 @@ lisp_align_free (POINTER_TYPE *block)
1041 eassert ((aligned & 1) == aligned); 1041 eassert ((aligned & 1) == aligned);
1042 eassert (i == (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1)); 1042 eassert (i == (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1));
1043#ifdef USE_POSIX_MEMALIGN 1043#ifdef USE_POSIX_MEMALIGN
1044 eassert ((EMACS_UINTPTR) ABLOCKS_BASE (abase) % BLOCK_ALIGN == 0); 1044 eassert ((uintptr_t) ABLOCKS_BASE (abase) % BLOCK_ALIGN == 0);
1045#endif 1045#endif
1046 free (ABLOCKS_BASE (abase)); 1046 free (ABLOCKS_BASE (abase));
1047 } 1047 }
@@ -1774,7 +1774,7 @@ check_string_free_list (void)
1774 s = string_free_list; 1774 s = string_free_list;
1775 while (s != NULL) 1775 while (s != NULL)
1776 { 1776 {
1777 if ((EMACS_UINTPTR) s < 1024) 1777 if ((uintptr_t) s < 1024)
1778 abort(); 1778 abort();
1779 s = NEXT_FREE_LISP_STRING (s); 1779 s = NEXT_FREE_LISP_STRING (s);
1780 } 1780 }
@@ -2434,10 +2434,10 @@ make_uninit_multibyte_string (EMACS_INT nchars, EMACS_INT nbytes)
2434 &= ~(1 << ((n) % (sizeof(int) * CHAR_BIT))) 2434 &= ~(1 << ((n) % (sizeof(int) * CHAR_BIT)))
2435 2435
2436#define FLOAT_BLOCK(fptr) \ 2436#define FLOAT_BLOCK(fptr) \
2437 ((struct float_block *) (((EMACS_UINTPTR) (fptr)) & ~(BLOCK_ALIGN - 1))) 2437 ((struct float_block *) (((uintptr_t) (fptr)) & ~(BLOCK_ALIGN - 1)))
2438 2438
2439#define FLOAT_INDEX(fptr) \ 2439#define FLOAT_INDEX(fptr) \
2440 ((((EMACS_UINTPTR) (fptr)) & (BLOCK_ALIGN - 1)) / sizeof (struct Lisp_Float)) 2440 ((((uintptr_t) (fptr)) & (BLOCK_ALIGN - 1)) / sizeof (struct Lisp_Float))
2441 2441
2442struct float_block 2442struct float_block
2443{ 2443{
@@ -2546,10 +2546,10 @@ make_float (double float_value)
2546 / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1)) 2546 / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1))
2547 2547
2548#define CONS_BLOCK(fptr) \ 2548#define CONS_BLOCK(fptr) \
2549 ((struct cons_block *) ((EMACS_UINTPTR) (fptr) & ~(BLOCK_ALIGN - 1))) 2549 ((struct cons_block *) ((uintptr_t) (fptr) & ~(BLOCK_ALIGN - 1)))
2550 2550
2551#define CONS_INDEX(fptr) \ 2551#define CONS_INDEX(fptr) \
2552 (((EMACS_UINTPTR) (fptr) & (BLOCK_ALIGN - 1)) / sizeof (struct Lisp_Cons)) 2552 (((uintptr_t) (fptr) & (BLOCK_ALIGN - 1)) / sizeof (struct Lisp_Cons))
2553 2553
2554struct cons_block 2554struct cons_block
2555{ 2555{
@@ -4023,7 +4023,7 @@ mark_maybe_pointer (void *p)
4023 struct mem_node *m; 4023 struct mem_node *m;
4024 4024
4025 /* Quickly rule out some values which can't point to Lisp data. */ 4025 /* Quickly rule out some values which can't point to Lisp data. */
4026 if ((EMACS_INTPTR) p % 4026 if ((intptr_t) p %
4027#ifdef USE_LSB_TAG 4027#ifdef USE_LSB_TAG
4028 8 /* USE_LSB_TAG needs Lisp data to be aligned on multiples of 8. */ 4028 8 /* USE_LSB_TAG needs Lisp data to be aligned on multiples of 8. */
4029#else 4029#else
@@ -6074,7 +6074,7 @@ We divide the value by 1024 to make sure it fits in a Lisp integer. */)
6074{ 6074{
6075 Lisp_Object end; 6075 Lisp_Object end;
6076 6076
6077 XSETINT (end, (EMACS_INTPTR) (char *) sbrk (0) / 1024); 6077 XSETINT (end, (intptr_t) (char *) sbrk (0) / 1024);
6078 6078
6079 return end; 6079 return end;
6080} 6080}