diff options
| author | Daniel Colascione | 2012-10-07 14:31:58 -0800 |
|---|---|---|
| committer | Daniel Colascione | 2012-10-07 14:31:58 -0800 |
| commit | 36a305a723c63fd345be65c536c52fe9765c14be (patch) | |
| tree | fb89d9e103552863214c60297a65320917109357 /src/ralloc.c | |
| parent | 2ab329f3b5d52a39f0a45c3d9c129f1c19560142 (diff) | |
| parent | 795b1482a9e314cda32d62ac2988f573d359366e (diff) | |
| download | emacs-36a305a723c63fd345be65c536c52fe9765c14be.tar.gz emacs-36a305a723c63fd345be65c536c52fe9765c14be.zip | |
Merge from trunk
Diffstat (limited to 'src/ralloc.c')
| -rw-r--r-- | src/ralloc.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/ralloc.c b/src/ralloc.c index 9a4b1ada229..11897411930 100644 --- a/src/ralloc.c +++ b/src/ralloc.c | |||
| @@ -72,7 +72,7 @@ static void r_alloc_init (void); | |||
| 72 | /* Declarations for working with the malloc, ralloc, and system breaks. */ | 72 | /* Declarations for working with the malloc, ralloc, and system breaks. */ |
| 73 | 73 | ||
| 74 | /* Function to set the real break value. */ | 74 | /* Function to set the real break value. */ |
| 75 | POINTER (*real_morecore) (long int); | 75 | POINTER (*real_morecore) (ptrdiff_t); |
| 76 | 76 | ||
| 77 | /* The break value, as seen by malloc. */ | 77 | /* The break value, as seen by malloc. */ |
| 78 | static POINTER virtual_break_value; | 78 | static POINTER virtual_break_value; |
| @@ -91,18 +91,18 @@ static int extra_bytes; | |||
| 91 | /* Macros for rounding. Note that rounding to any value is possible | 91 | /* Macros for rounding. Note that rounding to any value is possible |
| 92 | by changing the definition of PAGE. */ | 92 | by changing the definition of PAGE. */ |
| 93 | #define PAGE (getpagesize ()) | 93 | #define PAGE (getpagesize ()) |
| 94 | #define ROUNDUP(size) (((unsigned long int) (size) + page_size - 1) \ | 94 | #define ROUNDUP(size) (((size_t) (size) + page_size - 1) \ |
| 95 | & ~(page_size - 1)) | 95 | & ~((size_t)(page_size - 1))) |
| 96 | 96 | ||
| 97 | #define MEM_ALIGN sizeof (double) | 97 | #define MEM_ALIGN sizeof (double) |
| 98 | #define MEM_ROUNDUP(addr) (((unsigned long int)(addr) + MEM_ALIGN - 1) \ | 98 | #define MEM_ROUNDUP(addr) (((size_t)(addr) + MEM_ALIGN - 1) \ |
| 99 | & ~(MEM_ALIGN - 1)) | 99 | & ~(MEM_ALIGN - 1)) |
| 100 | 100 | ||
| 101 | /* The hook `malloc' uses for the function which gets more space | 101 | /* The hook `malloc' uses for the function which gets more space |
| 102 | from the system. */ | 102 | from the system. */ |
| 103 | 103 | ||
| 104 | #ifndef SYSTEM_MALLOC | 104 | #ifndef SYSTEM_MALLOC |
| 105 | extern POINTER (*__morecore) (long int); | 105 | extern POINTER (*__morecore) (ptrdiff_t); |
| 106 | #endif | 106 | #endif |
| 107 | 107 | ||
| 108 | 108 | ||
| @@ -308,7 +308,7 @@ static void | |||
| 308 | relinquish (void) | 308 | relinquish (void) |
| 309 | { | 309 | { |
| 310 | register heap_ptr h; | 310 | register heap_ptr h; |
| 311 | long excess = 0; | 311 | ptrdiff_t excess = 0; |
| 312 | 312 | ||
| 313 | /* Add the amount of space beyond break_value | 313 | /* Add the amount of space beyond break_value |
| 314 | in all heaps which have extend beyond break_value at all. */ | 314 | in all heaps which have extend beyond break_value at all. */ |
| @@ -327,10 +327,11 @@ relinquish (void) | |||
| 327 | 327 | ||
| 328 | if ((char *)last_heap->end - (char *)last_heap->bloc_start <= excess) | 328 | if ((char *)last_heap->end - (char *)last_heap->bloc_start <= excess) |
| 329 | { | 329 | { |
| 330 | /* This heap should have no blocs in it. */ | 330 | /* This heap should have no blocs in it. If it does, we |
| 331 | cannot return it to the system. */ | ||
| 331 | if (last_heap->first_bloc != NIL_BLOC | 332 | if (last_heap->first_bloc != NIL_BLOC |
| 332 | || last_heap->last_bloc != NIL_BLOC) | 333 | || last_heap->last_bloc != NIL_BLOC) |
| 333 | emacs_abort (); | 334 | return; |
| 334 | 335 | ||
| 335 | /* Return the last heap, with its header, to the system. */ | 336 | /* Return the last heap, with its header, to the system. */ |
| 336 | excess = (char *)last_heap->end - (char *)last_heap->start; | 337 | excess = (char *)last_heap->end - (char *)last_heap->start; |
| @@ -752,7 +753,7 @@ free_bloc (bloc_ptr bloc) | |||
| 752 | GNU malloc package. */ | 753 | GNU malloc package. */ |
| 753 | 754 | ||
| 754 | static POINTER | 755 | static POINTER |
| 755 | r_alloc_sbrk (long int size) | 756 | r_alloc_sbrk (ptrdiff_t size) |
| 756 | { | 757 | { |
| 757 | register bloc_ptr b; | 758 | register bloc_ptr b; |
| 758 | POINTER address; | 759 | POINTER address; |
| @@ -1199,9 +1200,9 @@ r_alloc_init (void) | |||
| 1199 | #endif | 1200 | #endif |
| 1200 | 1201 | ||
| 1201 | #ifdef DOUG_LEA_MALLOC | 1202 | #ifdef DOUG_LEA_MALLOC |
| 1202 | BLOCK_INPUT; | 1203 | block_input (); |
| 1203 | mallopt (M_TOP_PAD, 64 * 4096); | 1204 | mallopt (M_TOP_PAD, 64 * 4096); |
| 1204 | UNBLOCK_INPUT; | 1205 | unblock_input (); |
| 1205 | #else | 1206 | #else |
| 1206 | #ifndef SYSTEM_MALLOC | 1207 | #ifndef SYSTEM_MALLOC |
| 1207 | /* Give GNU malloc's morecore some hysteresis so that we move all | 1208 | /* Give GNU malloc's morecore some hysteresis so that we move all |