aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/alloc.c b/src/alloc.c
index a120ce9b61f..3601c256c41 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -66,7 +66,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
66 66
67#include <unistd.h> 67#include <unistd.h>
68#ifndef HAVE_UNISTD_H 68#ifndef HAVE_UNISTD_H
69extern POINTER_TYPE *sbrk (); 69extern void *sbrk ();
70#endif 70#endif
71 71
72#include <fcntl.h> 72#include <fcntl.h>
@@ -306,7 +306,7 @@ enum mem_type
306 MEM_TYPE_VECTORLIKE 306 MEM_TYPE_VECTORLIKE
307}; 307};
308 308
309static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); 309static void *lisp_malloc (size_t, enum mem_type);
310 310
311 311
312#if GC_MARK_STACK || defined GC_MALLOC_CHECK 312#if GC_MARK_STACK || defined GC_MALLOC_CHECK
@@ -388,7 +388,7 @@ static struct mem_node mem_z;
388#define MEM_NIL &mem_z 388#define MEM_NIL &mem_z
389 389
390static struct Lisp_Vector *allocate_vectorlike (EMACS_INT); 390static struct Lisp_Vector *allocate_vectorlike (EMACS_INT);
391static void lisp_free (POINTER_TYPE *); 391static void lisp_free (void *);
392static void mark_stack (void); 392static void mark_stack (void);
393static int live_vector_p (struct mem_node *, void *); 393static int live_vector_p (struct mem_node *, void *);
394static int live_buffer_p (struct mem_node *, void *); 394static int live_buffer_p (struct mem_node *, void *);
@@ -435,15 +435,15 @@ static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag};
435 435
436static int staticidx = 0; 436static int staticidx = 0;
437 437
438static POINTER_TYPE *pure_alloc (size_t, int); 438static void *pure_alloc (size_t, int);
439 439
440 440
441/* Value is SZ rounded up to the next multiple of ALIGNMENT. 441/* Value is SZ rounded up to the next multiple of ALIGNMENT.
442 ALIGNMENT must be a power of 2. */ 442 ALIGNMENT must be a power of 2. */
443 443
444#define ALIGN(ptr, ALIGNMENT) \ 444#define ALIGN(ptr, ALIGNMENT) \
445 ((POINTER_TYPE *) ((((uintptr_t) (ptr)) + (ALIGNMENT) - 1) \ 445 ((void *) (((uintptr_t) (ptr) + (ALIGNMENT) - 1) \
446 & ~((ALIGNMENT) - 1))) 446 & ~ ((ALIGNMENT) - 1)))
447 447
448 448
449 449
@@ -604,7 +604,7 @@ static ptrdiff_t check_depth;
604 604
605/* Like malloc, but wraps allocated block with header and trailer. */ 605/* Like malloc, but wraps allocated block with header and trailer. */
606 606
607static POINTER_TYPE * 607static void *
608overrun_check_malloc (size_t size) 608overrun_check_malloc (size_t size)
609{ 609{
610 register unsigned char *val; 610 register unsigned char *val;
@@ -622,15 +622,15 @@ overrun_check_malloc (size_t size)
622 XMALLOC_OVERRUN_CHECK_SIZE); 622 XMALLOC_OVERRUN_CHECK_SIZE);
623 } 623 }
624 --check_depth; 624 --check_depth;
625 return (POINTER_TYPE *)val; 625 return val;
626} 626}
627 627
628 628
629/* Like realloc, but checks old block for overrun, and wraps new block 629/* Like realloc, but checks old block for overrun, and wraps new block
630 with header and trailer. */ 630 with header and trailer. */
631 631
632static POINTER_TYPE * 632static void *
633overrun_check_realloc (POINTER_TYPE *block, size_t size) 633overrun_check_realloc (void *block, size_t size)
634{ 634{
635 register unsigned char *val = (unsigned char *) block; 635 register unsigned char *val = (unsigned char *) block;
636 int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0; 636 int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0;
@@ -652,7 +652,7 @@ overrun_check_realloc (POINTER_TYPE *block, size_t size)
652 memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE); 652 memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE);
653 } 653 }
654 654
655 val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); 655 val = realloc (val, size + overhead);
656 656
657 if (val && check_depth == 1) 657 if (val && check_depth == 1)
658 { 658 {
@@ -663,13 +663,13 @@ overrun_check_realloc (POINTER_TYPE *block, size_t size)
663 XMALLOC_OVERRUN_CHECK_SIZE); 663 XMALLOC_OVERRUN_CHECK_SIZE);
664 } 664 }
665 --check_depth; 665 --check_depth;
666 return (POINTER_TYPE *)val; 666 return val;
667} 667}
668 668
669/* Like free, but checks block for overrun. */ 669/* Like free, but checks block for overrun. */
670 670
671static void 671static void
672overrun_check_free (POINTER_TYPE *block) 672overrun_check_free (void *block)
673{ 673{
674 unsigned char *val = (unsigned char *) block; 674 unsigned char *val = (unsigned char *) block;
675 675
@@ -718,13 +718,13 @@ overrun_check_free (POINTER_TYPE *block)
718 718
719/* Like malloc but check for no memory and block interrupt input.. */ 719/* Like malloc but check for no memory and block interrupt input.. */
720 720
721POINTER_TYPE * 721void *
722xmalloc (size_t size) 722xmalloc (size_t size)
723{ 723{
724 register POINTER_TYPE *val; 724 void *val;
725 725
726 MALLOC_BLOCK_INPUT; 726 MALLOC_BLOCK_INPUT;
727 val = (POINTER_TYPE *) malloc (size); 727 val = malloc (size);
728 MALLOC_UNBLOCK_INPUT; 728 MALLOC_UNBLOCK_INPUT;
729 729
730 if (!val && size) 730 if (!val && size)
@@ -735,18 +735,18 @@ xmalloc (size_t size)
735 735
736/* Like realloc but check for no memory and block interrupt input.. */ 736/* Like realloc but check for no memory and block interrupt input.. */
737 737
738POINTER_TYPE * 738void *
739xrealloc (POINTER_TYPE *block, size_t size) 739xrealloc (void *block, size_t size)
740{ 740{
741 register POINTER_TYPE *val; 741 void *val;
742 742
743 MALLOC_BLOCK_INPUT; 743 MALLOC_BLOCK_INPUT;
744 /* We must call malloc explicitly when BLOCK is 0, since some 744 /* We must call malloc explicitly when BLOCK is 0, since some
745 reallocs don't do this. */ 745 reallocs don't do this. */
746 if (! block) 746 if (! block)
747 val = (POINTER_TYPE *) malloc (size); 747 val = malloc (size);
748 else 748 else
749 val = (POINTER_TYPE *) realloc (block, size); 749 val = realloc (block, size);
750 MALLOC_UNBLOCK_INPUT; 750 MALLOC_UNBLOCK_INPUT;
751 751
752 if (!val && size) 752 if (!val && size)
@@ -758,7 +758,7 @@ xrealloc (POINTER_TYPE *block, size_t size)
758/* Like free but block interrupt input. */ 758/* Like free but block interrupt input. */
759 759
760void 760void
761xfree (POINTER_TYPE *block) 761xfree (void *block)
762{ 762{
763 if (!block) 763 if (!block)
764 return; 764 return;
@@ -893,7 +893,7 @@ safe_alloca_unwind (Lisp_Object arg)
893static void *lisp_malloc_loser; 893static void *lisp_malloc_loser;
894#endif 894#endif
895 895
896static POINTER_TYPE * 896static void *
897lisp_malloc (size_t nbytes, enum mem_type type) 897lisp_malloc (size_t nbytes, enum mem_type type)
898{ 898{
899 register void *val; 899 register void *val;
@@ -938,7 +938,7 @@ lisp_malloc (size_t nbytes, enum mem_type type)
938 call to lisp_malloc. */ 938 call to lisp_malloc. */
939 939
940static void 940static void
941lisp_free (POINTER_TYPE *block) 941lisp_free (void *block)
942{ 942{
943 MALLOC_BLOCK_INPUT; 943 MALLOC_BLOCK_INPUT;
944 free (block); 944 free (block);
@@ -1034,7 +1034,7 @@ static struct ablock *free_ablock;
1034/* Allocate an aligned block of nbytes. 1034/* Allocate an aligned block of nbytes.
1035 Alignment is on a multiple of BLOCK_ALIGN and `nbytes' has to be 1035 Alignment is on a multiple of BLOCK_ALIGN and `nbytes' has to be
1036 smaller or equal to BLOCK_BYTES. */ 1036 smaller or equal to BLOCK_BYTES. */
1037static POINTER_TYPE * 1037static void *
1038lisp_align_malloc (size_t nbytes, enum mem_type type) 1038lisp_align_malloc (size_t nbytes, enum mem_type type)
1039{ 1039{
1040 void *base, *val; 1040 void *base, *val;
@@ -1141,7 +1141,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
1141} 1141}
1142 1142
1143static void 1143static void
1144lisp_align_free (POINTER_TYPE *block) 1144lisp_align_free (void *block)
1145{ 1145{
1146 struct ablock *ablock = block; 1146 struct ablock *ablock = block;
1147 struct ablocks *abase = ABLOCK_ABASE (ablock); 1147 struct ablocks *abase = ABLOCK_ABASE (ablock);
@@ -4722,10 +4722,10 @@ valid_lisp_object_p (Lisp_Object obj)
4722 pointer to it. TYPE is the Lisp type for which the memory is 4722 pointer to it. TYPE is the Lisp type for which the memory is
4723 allocated. TYPE < 0 means it's not used for a Lisp object. */ 4723 allocated. TYPE < 0 means it's not used for a Lisp object. */
4724 4724
4725static POINTER_TYPE * 4725static void *
4726pure_alloc (size_t size, int type) 4726pure_alloc (size_t size, int type)
4727{ 4727{
4728 POINTER_TYPE *result; 4728 void *result;
4729#ifdef USE_LSB_TAG 4729#ifdef USE_LSB_TAG
4730 size_t alignment = (1 << GCTYPEBITS); 4730 size_t alignment = (1 << GCTYPEBITS);
4731#else 4731#else