diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/buffer.c b/src/buffer.c index 2ddbc699481..4dcdf7bae69 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2051,10 +2051,10 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2051 | eassert (current_buffer->text == ¤t_buffer->own_text); | 2051 | eassert (current_buffer->text == ¤t_buffer->own_text); |
| 2052 | eassert (other_buffer->text == &other_buffer->own_text); | 2052 | eassert (other_buffer->text == &other_buffer->own_text); |
| 2053 | #ifdef REL_ALLOC | 2053 | #ifdef REL_ALLOC |
| 2054 | r_alloc_reset_variable ((POINTER_TYPE **) ¤t_buffer->own_text.beg, | 2054 | r_alloc_reset_variable ((void **) ¤t_buffer->own_text.beg, |
| 2055 | (POINTER_TYPE **) &other_buffer->own_text.beg); | 2055 | (void **) &other_buffer->own_text.beg); |
| 2056 | r_alloc_reset_variable ((POINTER_TYPE **) &other_buffer->own_text.beg, | 2056 | r_alloc_reset_variable ((void **) &other_buffer->own_text.beg, |
| 2057 | (POINTER_TYPE **) ¤t_buffer->own_text.beg); | 2057 | (void **) ¤t_buffer->own_text.beg); |
| 2058 | #endif /* REL_ALLOC */ | 2058 | #endif /* REL_ALLOC */ |
| 2059 | 2059 | ||
| 2060 | swapfield (pt, EMACS_INT); | 2060 | swapfield (pt, EMACS_INT); |
| @@ -4383,7 +4383,7 @@ struct mmap_region | |||
| 4383 | /* Pointer to the location holding the address of the memory | 4383 | /* Pointer to the location holding the address of the memory |
| 4384 | allocated with the mmap'd block. The variable actually points | 4384 | allocated with the mmap'd block. The variable actually points |
| 4385 | after this structure. */ | 4385 | after this structure. */ |
| 4386 | POINTER_TYPE **var; | 4386 | void **var; |
| 4387 | 4387 | ||
| 4388 | /* Next and previous in list of all mmap'd regions. */ | 4388 | /* Next and previous in list of all mmap'd regions. */ |
| 4389 | struct mmap_region *next, *prev; | 4389 | struct mmap_region *next, *prev; |
| @@ -4430,7 +4430,7 @@ static int mmap_initialized_p; | |||
| 4430 | to the start of the user-visible part of the region. */ | 4430 | to the start of the user-visible part of the region. */ |
| 4431 | 4431 | ||
| 4432 | #define MMAP_USER_AREA(P) \ | 4432 | #define MMAP_USER_AREA(P) \ |
| 4433 | ((POINTER_TYPE *) ((char *) (P) + MMAP_REGION_STRUCT_SIZE)) | 4433 | ((void *) ((char *) (P) + MMAP_REGION_STRUCT_SIZE)) |
| 4434 | 4434 | ||
| 4435 | #define MEM_ALIGN sizeof (double) | 4435 | #define MEM_ALIGN sizeof (double) |
| 4436 | 4436 | ||
| @@ -4479,7 +4479,7 @@ mmap_init (void) | |||
| 4479 | is at END - 1. */ | 4479 | is at END - 1. */ |
| 4480 | 4480 | ||
| 4481 | static struct mmap_region * | 4481 | static struct mmap_region * |
| 4482 | mmap_find (POINTER_TYPE *start, POINTER_TYPE *end) | 4482 | mmap_find (void *start, void *end) |
| 4483 | { | 4483 | { |
| 4484 | struct mmap_region *r; | 4484 | struct mmap_region *r; |
| 4485 | char *s = (char *) start, *e = (char *) end; | 4485 | char *s = (char *) start, *e = (char *) end; |
| @@ -4517,7 +4517,7 @@ mmap_free_1 (struct mmap_region *r) | |||
| 4517 | else | 4517 | else |
| 4518 | mmap_regions = r->next; | 4518 | mmap_regions = r->next; |
| 4519 | 4519 | ||
| 4520 | if (munmap ((POINTER_TYPE *) r, r->nbytes_mapped) == -1) | 4520 | if (munmap (r, r->nbytes_mapped) == -1) |
| 4521 | { | 4521 | { |
| 4522 | fprintf (stderr, "munmap: %s\n", emacs_strerror (errno)); | 4522 | fprintf (stderr, "munmap: %s\n", emacs_strerror (errno)); |
| 4523 | return 0; | 4523 | return 0; |
| @@ -4559,13 +4559,13 @@ mmap_enlarge (struct mmap_region *r, int npages) | |||
| 4559 | I'm not sure this is worth doing, let's see. */ | 4559 | I'm not sure this is worth doing, let's see. */ |
| 4560 | if (!MMAP_ALLOCATED_P (region_end, region_end + nbytes)) | 4560 | if (!MMAP_ALLOCATED_P (region_end, region_end + nbytes)) |
| 4561 | { | 4561 | { |
| 4562 | POINTER_TYPE *p; | 4562 | void *p; |
| 4563 | 4563 | ||
| 4564 | p = mmap (region_end, nbytes, PROT_READ | PROT_WRITE, | 4564 | p = mmap (region_end, nbytes, PROT_READ | PROT_WRITE, |
| 4565 | MAP_ANON | MAP_PRIVATE | MAP_FIXED, mmap_fd, 0); | 4565 | MAP_ANON | MAP_PRIVATE | MAP_FIXED, mmap_fd, 0); |
| 4566 | if (p == MAP_FAILED) | 4566 | if (p == MAP_FAILED) |
| 4567 | ; /* fprintf (stderr, "mmap: %s\n", emacs_strerror (errno)); */ | 4567 | ; /* fprintf (stderr, "mmap: %s\n", emacs_strerror (errno)); */ |
| 4568 | else if (p != (POINTER_TYPE *) region_end) | 4568 | else if (p != region_end) |
| 4569 | { | 4569 | { |
| 4570 | /* Kernels are free to choose a different address. In | 4570 | /* Kernels are free to choose a different address. In |
| 4571 | that case, unmap what we've mapped above; we have | 4571 | that case, unmap what we've mapped above; we have |
| @@ -4627,8 +4627,8 @@ mmap_set_vars (int restore_p) | |||
| 4627 | If we can't allocate the necessary memory, set *VAR to null, and | 4627 | If we can't allocate the necessary memory, set *VAR to null, and |
| 4628 | return null. */ | 4628 | return null. */ |
| 4629 | 4629 | ||
| 4630 | static POINTER_TYPE * | 4630 | static void * |
| 4631 | mmap_alloc (POINTER_TYPE **var, size_t nbytes) | 4631 | mmap_alloc (void **var, size_t nbytes) |
| 4632 | { | 4632 | { |
| 4633 | void *p; | 4633 | void *p; |
| 4634 | size_t map; | 4634 | size_t map; |
| @@ -4669,7 +4669,7 @@ mmap_alloc (POINTER_TYPE **var, size_t nbytes) | |||
| 4669 | PTR. Store 0 in *PTR to show there's no block allocated. */ | 4669 | PTR. Store 0 in *PTR to show there's no block allocated. */ |
| 4670 | 4670 | ||
| 4671 | static void | 4671 | static void |
| 4672 | mmap_free (POINTER_TYPE **var) | 4672 | mmap_free (void **var) |
| 4673 | { | 4673 | { |
| 4674 | mmap_init (); | 4674 | mmap_init (); |
| 4675 | 4675 | ||
| @@ -4686,10 +4686,10 @@ mmap_free (POINTER_TYPE **var) | |||
| 4686 | and return this value. If more memory cannot be allocated, then | 4686 | and return this value. If more memory cannot be allocated, then |
| 4687 | leave *VAR unchanged, and return null. */ | 4687 | leave *VAR unchanged, and return null. */ |
| 4688 | 4688 | ||
| 4689 | static POINTER_TYPE * | 4689 | static void * |
| 4690 | mmap_realloc (POINTER_TYPE **var, size_t nbytes) | 4690 | mmap_realloc (void **var, size_t nbytes) |
| 4691 | { | 4691 | { |
| 4692 | POINTER_TYPE *result; | 4692 | void *result; |
| 4693 | 4693 | ||
| 4694 | mmap_init (); | 4694 | mmap_init (); |
| 4695 | 4695 | ||
| @@ -4708,7 +4708,7 @@ mmap_realloc (POINTER_TYPE **var, size_t nbytes) | |||
| 4708 | if (room < nbytes) | 4708 | if (room < nbytes) |
| 4709 | { | 4709 | { |
| 4710 | /* Must enlarge. */ | 4710 | /* Must enlarge. */ |
| 4711 | POINTER_TYPE *old_ptr = *var; | 4711 | void *old_ptr = *var; |
| 4712 | 4712 | ||
| 4713 | /* Try to map additional pages at the end of the region. | 4713 | /* Try to map additional pages at the end of the region. |
| 4714 | If that fails, allocate a new region, copy data | 4714 | If that fails, allocate a new region, copy data |
| @@ -4770,13 +4770,13 @@ mmap_realloc (POINTER_TYPE **var, size_t nbytes) | |||
| 4770 | static void | 4770 | static void |
| 4771 | alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes) | 4771 | alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes) |
| 4772 | { | 4772 | { |
| 4773 | POINTER_TYPE *p; | 4773 | void *p; |
| 4774 | 4774 | ||
| 4775 | BLOCK_INPUT; | 4775 | BLOCK_INPUT; |
| 4776 | #if defined USE_MMAP_FOR_BUFFERS | 4776 | #if defined USE_MMAP_FOR_BUFFERS |
| 4777 | p = mmap_alloc ((POINTER_TYPE **) &b->text->beg, nbytes); | 4777 | p = mmap_alloc ((void **) &b->text->beg, nbytes); |
| 4778 | #elif defined REL_ALLOC | 4778 | #elif defined REL_ALLOC |
| 4779 | p = r_alloc ((POINTER_TYPE **) &b->text->beg, nbytes); | 4779 | p = r_alloc ((void **) &b->text->beg, nbytes); |
| 4780 | #else | 4780 | #else |
| 4781 | p = xmalloc (nbytes); | 4781 | p = xmalloc (nbytes); |
| 4782 | #endif | 4782 | #endif |
| @@ -4797,14 +4797,14 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes) | |||
| 4797 | void | 4797 | void |
| 4798 | enlarge_buffer_text (struct buffer *b, EMACS_INT delta) | 4798 | enlarge_buffer_text (struct buffer *b, EMACS_INT delta) |
| 4799 | { | 4799 | { |
| 4800 | POINTER_TYPE *p; | 4800 | void *p; |
| 4801 | ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 | 4801 | ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 |
| 4802 | + delta); | 4802 | + delta); |
| 4803 | BLOCK_INPUT; | 4803 | BLOCK_INPUT; |
| 4804 | #if defined USE_MMAP_FOR_BUFFERS | 4804 | #if defined USE_MMAP_FOR_BUFFERS |
| 4805 | p = mmap_realloc ((POINTER_TYPE **) &b->text->beg, nbytes); | 4805 | p = mmap_realloc ((void **) &b->text->beg, nbytes); |
| 4806 | #elif defined REL_ALLOC | 4806 | #elif defined REL_ALLOC |
| 4807 | p = r_re_alloc ((POINTER_TYPE **) &b->text->beg, nbytes); | 4807 | p = r_re_alloc ((void **) &b->text->beg, nbytes); |
| 4808 | #else | 4808 | #else |
| 4809 | p = xrealloc (b->text->beg, nbytes); | 4809 | p = xrealloc (b->text->beg, nbytes); |
| 4810 | #endif | 4810 | #endif |
| @@ -4828,9 +4828,9 @@ free_buffer_text (struct buffer *b) | |||
| 4828 | BLOCK_INPUT; | 4828 | BLOCK_INPUT; |
| 4829 | 4829 | ||
| 4830 | #if defined USE_MMAP_FOR_BUFFERS | 4830 | #if defined USE_MMAP_FOR_BUFFERS |
| 4831 | mmap_free ((POINTER_TYPE **) &b->text->beg); | 4831 | mmap_free ((void **) &b->text->beg); |
| 4832 | #elif defined REL_ALLOC | 4832 | #elif defined REL_ALLOC |
| 4833 | r_alloc_free ((POINTER_TYPE **) &b->text->beg); | 4833 | r_alloc_free ((void **) &b->text->beg); |
| 4834 | #else | 4834 | #else |
| 4835 | xfree (b->text->beg); | 4835 | xfree (b->text->beg); |
| 4836 | #endif | 4836 | #endif |