diff options
| author | Gerd Moellmann | 2000-09-07 19:24:42 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-09-07 19:24:42 +0000 |
| commit | 91a211b50d4f29fcd2a9f3a164e1baecbb09460e (patch) | |
| tree | 3ebc0d0810c5f82227553259d527a2180f971922 /src/ralloc.c | |
| parent | 0341944076e36b309d334b144f4dae3f2400d35b (diff) | |
| download | emacs-91a211b50d4f29fcd2a9f3a164e1baecbb09460e.tar.gz emacs-91a211b50d4f29fcd2a9f3a164e1baecbb09460e.zip | |
(obtain, relinquish, relinquish, r_alloc_size_in_use)
(get_bloc, relocate_blocs, update_heap_bloc_correspondence)
(resize_bloc, r_alloc_sbrk, r_alloc_init): Add casts to `char *'
where necessary, in case POINTER_TYPE is `void'.
Diffstat (limited to 'src/ralloc.c')
| -rw-r--r-- | src/ralloc.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/ralloc.c b/src/ralloc.c index ae2d70ee709..0700bf9c664 100644 --- a/src/ralloc.c +++ b/src/ralloc.c | |||
| @@ -252,7 +252,7 @@ obtain (address, size) | |||
| 252 | 252 | ||
| 253 | /* If we can't fit SIZE bytes in that heap, | 253 | /* If we can't fit SIZE bytes in that heap, |
| 254 | try successive later heaps. */ | 254 | try successive later heaps. */ |
| 255 | while (heap && address + size > heap->end) | 255 | while (heap && (char *) address + size > (char *) heap->end) |
| 256 | { | 256 | { |
| 257 | heap = heap->next; | 257 | heap = heap->next; |
| 258 | if (heap == NIL_HEAP) | 258 | if (heap == NIL_HEAP) |
| @@ -276,7 +276,7 @@ obtain (address, size) | |||
| 276 | heap_ptr new_heap = (heap_ptr) MEM_ROUNDUP (new); | 276 | heap_ptr new_heap = (heap_ptr) MEM_ROUNDUP (new); |
| 277 | POINTER bloc_start = (POINTER) MEM_ROUNDUP ((POINTER)(new_heap + 1)); | 277 | POINTER bloc_start = (POINTER) MEM_ROUNDUP ((POINTER)(new_heap + 1)); |
| 278 | 278 | ||
| 279 | if ((*real_morecore) (bloc_start - new) != new) | 279 | if ((*real_morecore) ((char *) bloc_start - (char *) new) != new) |
| 280 | return 0; | 280 | return 0; |
| 281 | 281 | ||
| 282 | new_heap->start = new; | 282 | new_heap->start = new; |
| @@ -304,7 +304,7 @@ obtain (address, size) | |||
| 304 | if ((*real_morecore) (get) != last_heap->end) | 304 | if ((*real_morecore) (get) != last_heap->end) |
| 305 | return 0; | 305 | return 0; |
| 306 | 306 | ||
| 307 | last_heap->end += get; | 307 | last_heap->end = (char *) last_heap->end + get; |
| 308 | } | 308 | } |
| 309 | 309 | ||
| 310 | return address; | 310 | return address; |
| @@ -352,7 +352,7 @@ relinquish () | |||
| 352 | { | 352 | { |
| 353 | excess = (char *) last_heap->end | 353 | excess = (char *) last_heap->end |
| 354 | - (char *) ROUNDUP ((char *)last_heap->end - excess); | 354 | - (char *) ROUNDUP ((char *)last_heap->end - excess); |
| 355 | last_heap->end -= excess; | 355 | last_heap->end = (char *) last_heap->end - excess; |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | if ((*real_morecore) (- excess) == 0) | 358 | if ((*real_morecore) (- excess) == 0) |
| @@ -360,7 +360,7 @@ relinquish () | |||
| 360 | /* If the system didn't want that much memory back, adjust | 360 | /* If the system didn't want that much memory back, adjust |
| 361 | the end of the last heap to reflect that. This can occur | 361 | the end of the last heap to reflect that. This can occur |
| 362 | if break_value is still within the original data segment. */ | 362 | if break_value is still within the original data segment. */ |
| 363 | last_heap->end += excess; | 363 | last_heap->end = (char *) last_heap->end + excess; |
| 364 | /* Make sure that the result of the adjustment is accurate. | 364 | /* Make sure that the result of the adjustment is accurate. |
| 365 | It should be, for the else clause above; the other case, | 365 | It should be, for the else clause above; the other case, |
| 366 | which returns the entire last heap to the system, seems | 366 | which returns the entire last heap to the system, seems |
| @@ -377,7 +377,7 @@ relinquish () | |||
| 377 | long | 377 | long |
| 378 | r_alloc_size_in_use () | 378 | r_alloc_size_in_use () |
| 379 | { | 379 | { |
| 380 | return break_value - virtual_break_value; | 380 | return (char *) break_value - (char *) virtual_break_value; |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | /* The meat - allocating, freeing, and relocating blocs. */ | 383 | /* The meat - allocating, freeing, and relocating blocs. */ |
| @@ -422,7 +422,7 @@ get_bloc (size) | |||
| 422 | return 0; | 422 | return 0; |
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | break_value = new_bloc->data + size; | 425 | break_value = (char *) new_bloc->data + size; |
| 426 | 426 | ||
| 427 | new_bloc->size = size; | 427 | new_bloc->size = size; |
| 428 | new_bloc->next = NIL_BLOC; | 428 | new_bloc->next = NIL_BLOC; |
| @@ -479,7 +479,7 @@ relocate_blocs (bloc, heap, address) | |||
| 479 | { | 479 | { |
| 480 | /* If bloc B won't fit within HEAP, | 480 | /* If bloc B won't fit within HEAP, |
| 481 | move to the next heap and try again. */ | 481 | move to the next heap and try again. */ |
| 482 | while (heap && address + b->size > heap->end) | 482 | while (heap && (char *) address + b->size > (char *) heap->end) |
| 483 | { | 483 | { |
| 484 | heap = heap->next; | 484 | heap = heap->next; |
| 485 | if (heap == NIL_HEAP) | 485 | if (heap == NIL_HEAP) |
| @@ -515,7 +515,7 @@ relocate_blocs (bloc, heap, address) | |||
| 515 | and update where the next bloc can start. */ | 515 | and update where the next bloc can start. */ |
| 516 | b->new_data = address; | 516 | b->new_data = address; |
| 517 | if (b->variable) | 517 | if (b->variable) |
| 518 | address += b->size; | 518 | address = (char *) address + b->size; |
| 519 | b = b->next; | 519 | b = b->next; |
| 520 | } | 520 | } |
| 521 | 521 | ||
| @@ -567,7 +567,7 @@ update_heap_bloc_correspondence (bloc, heap) | |||
| 567 | { | 567 | { |
| 568 | /* The previous bloc is in HEAP. */ | 568 | /* The previous bloc is in HEAP. */ |
| 569 | heap->last_bloc = bloc->prev; | 569 | heap->last_bloc = bloc->prev; |
| 570 | heap->free = bloc->prev->data + bloc->prev->size; | 570 | heap->free = (char *) bloc->prev->data + bloc->prev->size; |
| 571 | } | 571 | } |
| 572 | else | 572 | else |
| 573 | { | 573 | { |
| @@ -595,7 +595,7 @@ update_heap_bloc_correspondence (bloc, heap) | |||
| 595 | } | 595 | } |
| 596 | 596 | ||
| 597 | /* Update HEAP's status for bloc B. */ | 597 | /* Update HEAP's status for bloc B. */ |
| 598 | heap->free = b->data + b->size; | 598 | heap->free = (char *) b->data + b->size; |
| 599 | heap->last_bloc = b; | 599 | heap->last_bloc = b; |
| 600 | if (heap->first_bloc == NIL_BLOC) | 600 | if (heap->first_bloc == NIL_BLOC) |
| 601 | heap->first_bloc = b; | 601 | heap->first_bloc = b; |
| @@ -649,8 +649,8 @@ resize_bloc (bloc, size) | |||
| 649 | bloc->size = size; | 649 | bloc->size = size; |
| 650 | 650 | ||
| 651 | /* Note that bloc could be moved into the previous heap. */ | 651 | /* Note that bloc could be moved into the previous heap. */ |
| 652 | address = (bloc->prev ? bloc->prev->data + bloc->prev->size | 652 | address = (bloc->prev ? (char *) bloc->prev->data + bloc->prev->size |
| 653 | : first_heap->bloc_start); | 653 | : (char *) first_heap->bloc_start); |
| 654 | while (heap) | 654 | while (heap) |
| 655 | { | 655 | { |
| 656 | if (heap->bloc_start <= address && address <= heap->end) | 656 | if (heap->bloc_start <= address && address <= heap->end) |
| @@ -687,7 +687,7 @@ resize_bloc (bloc, size) | |||
| 687 | else | 687 | else |
| 688 | { | 688 | { |
| 689 | safe_bcopy (bloc->data, bloc->new_data, old_size); | 689 | safe_bcopy (bloc->data, bloc->new_data, old_size); |
| 690 | bzero (bloc->new_data + old_size, size - old_size); | 690 | bzero ((char *) bloc->new_data + old_size, size - old_size); |
| 691 | *bloc->variable = bloc->data = bloc->new_data; | 691 | *bloc->variable = bloc->data = bloc->new_data; |
| 692 | } | 692 | } |
| 693 | } | 693 | } |
| @@ -710,8 +710,8 @@ resize_bloc (bloc, size) | |||
| 710 | 710 | ||
| 711 | update_heap_bloc_correspondence (bloc, heap); | 711 | update_heap_bloc_correspondence (bloc, heap); |
| 712 | 712 | ||
| 713 | break_value = (last_bloc ? last_bloc->data + last_bloc->size | 713 | break_value = (last_bloc ? (char *) last_bloc->data + last_bloc->size |
| 714 | : first_heap->bloc_start); | 714 | : (char *) first_heap->bloc_start); |
| 715 | return 1; | 715 | return 1; |
| 716 | } | 716 | } |
| 717 | 717 | ||
| @@ -917,8 +917,8 @@ r_alloc_sbrk (size) | |||
| 917 | 917 | ||
| 918 | virtual_break_value = (POINTER) ((char *)address + size); | 918 | virtual_break_value = (POINTER) ((char *)address + size); |
| 919 | break_value = (last_bloc | 919 | break_value = (last_bloc |
| 920 | ? last_bloc->data + last_bloc->size | 920 | ? (char *) last_bloc->data + last_bloc->size |
| 921 | : first_heap->bloc_start); | 921 | : (char *) first_heap->bloc_start); |
| 922 | if (size < 0) | 922 | if (size < 0) |
| 923 | relinquish (); | 923 | relinquish (); |
| 924 | 924 | ||
| @@ -1660,13 +1660,14 @@ r_alloc_init () | |||
| 1660 | which page_size is stored. This allows a binary to be built on a | 1660 | which page_size is stored. This allows a binary to be built on a |
| 1661 | system with one page size and run on a system with a smaller page | 1661 | system with one page size and run on a system with a smaller page |
| 1662 | size. */ | 1662 | size. */ |
| 1663 | (*real_morecore) (first_heap->end - first_heap->start); | 1663 | (*real_morecore) ((char *) first_heap->end - (char *) first_heap->start); |
| 1664 | 1664 | ||
| 1665 | /* Clear the rest of the last page; this memory is in our address space | 1665 | /* Clear the rest of the last page; this memory is in our address space |
| 1666 | even though it is after the sbrk value. */ | 1666 | even though it is after the sbrk value. */ |
| 1667 | /* Doubly true, with the additional call that explicitly adds the | 1667 | /* Doubly true, with the additional call that explicitly adds the |
| 1668 | rest of that page to the address space. */ | 1668 | rest of that page to the address space. */ |
| 1669 | bzero (first_heap->start, first_heap->end - first_heap->start); | 1669 | bzero (first_heap->start, |
| 1670 | (char *) first_heap->end - (char *) first_heap->start); | ||
| 1670 | virtual_break_value = break_value = first_heap->bloc_start = first_heap->end; | 1671 | virtual_break_value = break_value = first_heap->bloc_start = first_heap->end; |
| 1671 | use_relocatable_buffers = 1; | 1672 | use_relocatable_buffers = 1; |
| 1672 | } | 1673 | } |