diff options
| author | Kenichi Handa | 2010-07-08 17:09:35 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-07-08 17:09:35 +0900 |
| commit | 80d4189187791916590b6c2b20b54588d432bb75 (patch) | |
| tree | e59e52ee4a456f3235bff0e7fba4362681dba7dd /src/alloc.c | |
| parent | a7840ffb291e13c2a2386ccbd58089e1d7461c16 (diff) | |
| parent | 0216627eb39f77958e30f4750f581714fdfd7faf (diff) | |
| download | emacs-80d4189187791916590b6c2b20b54588d432bb75.tar.gz emacs-80d4189187791916590b6c2b20b54588d432bb75.zip | |
merge trunk
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 482 |
1 files changed, 192 insertions, 290 deletions
diff --git a/src/alloc.c b/src/alloc.c index e0f07cc5f5a..62b6e449831 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -329,23 +329,23 @@ Lisp_Object Vpost_gc_hook, Qpost_gc_hook; | |||
| 329 | Lisp_Object Vgc_elapsed; /* accumulated elapsed time in GC */ | 329 | Lisp_Object Vgc_elapsed; /* accumulated elapsed time in GC */ |
| 330 | EMACS_INT gcs_done; /* accumulated GCs */ | 330 | EMACS_INT gcs_done; /* accumulated GCs */ |
| 331 | 331 | ||
| 332 | static void mark_buffer P_ ((Lisp_Object)); | 332 | static void mark_buffer (Lisp_Object); |
| 333 | static void mark_terminals P_ ((void)); | 333 | static void mark_terminals (void); |
| 334 | extern void mark_kboards P_ ((void)); | 334 | extern void mark_kboards (void); |
| 335 | extern void mark_ttys P_ ((void)); | 335 | extern void mark_ttys (void); |
| 336 | extern void mark_backtrace P_ ((void)); | 336 | extern void mark_backtrace (void); |
| 337 | static void gc_sweep P_ ((void)); | 337 | static void gc_sweep (void); |
| 338 | static void mark_glyph_matrix P_ ((struct glyph_matrix *)); | 338 | static void mark_glyph_matrix (struct glyph_matrix *); |
| 339 | static void mark_face_cache P_ ((struct face_cache *)); | 339 | static void mark_face_cache (struct face_cache *); |
| 340 | 340 | ||
| 341 | #ifdef HAVE_WINDOW_SYSTEM | 341 | #ifdef HAVE_WINDOW_SYSTEM |
| 342 | extern void mark_fringe_data P_ ((void)); | 342 | extern void mark_fringe_data (void); |
| 343 | #endif /* HAVE_WINDOW_SYSTEM */ | 343 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 344 | 344 | ||
| 345 | static struct Lisp_String *allocate_string P_ ((void)); | 345 | static struct Lisp_String *allocate_string (void); |
| 346 | static void compact_small_strings P_ ((void)); | 346 | static void compact_small_strings (void); |
| 347 | static void free_large_strings P_ ((void)); | 347 | static void free_large_strings (void); |
| 348 | static void sweep_strings P_ ((void)); | 348 | static void sweep_strings (void); |
| 349 | 349 | ||
| 350 | extern int message_enable_multibyte; | 350 | extern int message_enable_multibyte; |
| 351 | 351 | ||
| @@ -369,9 +369,9 @@ enum mem_type | |||
| 369 | MEM_TYPE_VECTORLIKE | 369 | MEM_TYPE_VECTORLIKE |
| 370 | }; | 370 | }; |
| 371 | 371 | ||
| 372 | static POINTER_TYPE *lisp_align_malloc P_ ((size_t, enum mem_type)); | 372 | static POINTER_TYPE *lisp_align_malloc (size_t, enum mem_type); |
| 373 | static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type)); | 373 | static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); |
| 374 | void refill_memory_reserve (); | 374 | void refill_memory_reserve (void); |
| 375 | 375 | ||
| 376 | 376 | ||
| 377 | #if GC_MARK_STACK || defined GC_MALLOC_CHECK | 377 | #if GC_MARK_STACK || defined GC_MALLOC_CHECK |
| @@ -452,31 +452,31 @@ static void *min_heap_address, *max_heap_address; | |||
| 452 | static struct mem_node mem_z; | 452 | static struct mem_node mem_z; |
| 453 | #define MEM_NIL &mem_z | 453 | #define MEM_NIL &mem_z |
| 454 | 454 | ||
| 455 | static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type)); | 455 | static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); |
| 456 | static struct Lisp_Vector *allocate_vectorlike P_ ((EMACS_INT)); | 456 | static struct Lisp_Vector *allocate_vectorlike (EMACS_INT); |
| 457 | static void lisp_free P_ ((POINTER_TYPE *)); | 457 | static void lisp_free (POINTER_TYPE *); |
| 458 | static void mark_stack P_ ((void)); | 458 | static void mark_stack (void); |
| 459 | static int live_vector_p P_ ((struct mem_node *, void *)); | 459 | static int live_vector_p (struct mem_node *, void *); |
| 460 | static int live_buffer_p P_ ((struct mem_node *, void *)); | 460 | static int live_buffer_p (struct mem_node *, void *); |
| 461 | static int live_string_p P_ ((struct mem_node *, void *)); | 461 | static int live_string_p (struct mem_node *, void *); |
| 462 | static int live_cons_p P_ ((struct mem_node *, void *)); | 462 | static int live_cons_p (struct mem_node *, void *); |
| 463 | static int live_symbol_p P_ ((struct mem_node *, void *)); | 463 | static int live_symbol_p (struct mem_node *, void *); |
| 464 | static int live_float_p P_ ((struct mem_node *, void *)); | 464 | static int live_float_p (struct mem_node *, void *); |
| 465 | static int live_misc_p P_ ((struct mem_node *, void *)); | 465 | static int live_misc_p (struct mem_node *, void *); |
| 466 | static void mark_maybe_object P_ ((Lisp_Object)); | 466 | static void mark_maybe_object (Lisp_Object); |
| 467 | static void mark_memory P_ ((void *, void *, int)); | 467 | static void mark_memory (void *, void *, int); |
| 468 | static void mem_init P_ ((void)); | 468 | static void mem_init (void); |
| 469 | static struct mem_node *mem_insert P_ ((void *, void *, enum mem_type)); | 469 | static struct mem_node *mem_insert (void *, void *, enum mem_type); |
| 470 | static void mem_insert_fixup P_ ((struct mem_node *)); | 470 | static void mem_insert_fixup (struct mem_node *); |
| 471 | static void mem_rotate_left P_ ((struct mem_node *)); | 471 | static void mem_rotate_left (struct mem_node *); |
| 472 | static void mem_rotate_right P_ ((struct mem_node *)); | 472 | static void mem_rotate_right (struct mem_node *); |
| 473 | static void mem_delete P_ ((struct mem_node *)); | 473 | static void mem_delete (struct mem_node *); |
| 474 | static void mem_delete_fixup P_ ((struct mem_node *)); | 474 | static void mem_delete_fixup (struct mem_node *); |
| 475 | static INLINE struct mem_node *mem_find P_ ((void *)); | 475 | static INLINE struct mem_node *mem_find (void *); |
| 476 | 476 | ||
| 477 | 477 | ||
| 478 | #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS | 478 | #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS |
| 479 | static void check_gcpros P_ ((void)); | 479 | static void check_gcpros (void); |
| 480 | #endif | 480 | #endif |
| 481 | 481 | ||
| 482 | #endif /* GC_MARK_STACK || GC_MALLOC_CHECK */ | 482 | #endif /* GC_MARK_STACK || GC_MALLOC_CHECK */ |
| @@ -495,7 +495,7 @@ static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag}; | |||
| 495 | 495 | ||
| 496 | static int staticidx = 0; | 496 | static int staticidx = 0; |
| 497 | 497 | ||
| 498 | static POINTER_TYPE *pure_alloc P_ ((size_t, int)); | 498 | static POINTER_TYPE *pure_alloc (size_t, int); |
| 499 | 499 | ||
| 500 | 500 | ||
| 501 | /* Value is SZ rounded up to the next multiple of ALIGNMENT. | 501 | /* Value is SZ rounded up to the next multiple of ALIGNMENT. |
| @@ -514,8 +514,7 @@ static POINTER_TYPE *pure_alloc P_ ((size_t, int)); | |||
| 514 | /* Function malloc calls this if it finds we are near exhausting storage. */ | 514 | /* Function malloc calls this if it finds we are near exhausting storage. */ |
| 515 | 515 | ||
| 516 | void | 516 | void |
| 517 | malloc_warning (str) | 517 | malloc_warning (char *str) |
| 518 | char *str; | ||
| 519 | { | 518 | { |
| 520 | pending_malloc_warning = str; | 519 | pending_malloc_warning = str; |
| 521 | } | 520 | } |
| @@ -524,7 +523,7 @@ malloc_warning (str) | |||
| 524 | /* Display an already-pending malloc warning. */ | 523 | /* Display an already-pending malloc warning. */ |
| 525 | 524 | ||
| 526 | void | 525 | void |
| 527 | display_malloc_warning () | 526 | display_malloc_warning (void) |
| 528 | { | 527 | { |
| 529 | call3 (intern ("display-warning"), | 528 | call3 (intern ("display-warning"), |
| 530 | intern ("alloc"), | 529 | intern ("alloc"), |
| @@ -543,7 +542,7 @@ display_malloc_warning () | |||
| 543 | /* Called if we can't allocate relocatable space for a buffer. */ | 542 | /* Called if we can't allocate relocatable space for a buffer. */ |
| 544 | 543 | ||
| 545 | void | 544 | void |
| 546 | buffer_memory_full () | 545 | buffer_memory_full (void) |
| 547 | { | 546 | { |
| 548 | /* If buffers use the relocating allocator, no need to free | 547 | /* If buffers use the relocating allocator, no need to free |
| 549 | spare_memory, because we may have plenty of malloc space left | 548 | spare_memory, because we may have plenty of malloc space left |
| @@ -637,10 +636,12 @@ overrun_check_malloc (size) | |||
| 637 | val = (unsigned char *) malloc (size + overhead); | 636 | val = (unsigned char *) malloc (size + overhead); |
| 638 | if (val && check_depth == 1) | 637 | if (val && check_depth == 1) |
| 639 | { | 638 | { |
| 640 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); | 639 | memcpy (val, xmalloc_overrun_check_header, |
| 640 | XMALLOC_OVERRUN_CHECK_SIZE - 4); | ||
| 641 | val += XMALLOC_OVERRUN_CHECK_SIZE; | 641 | val += XMALLOC_OVERRUN_CHECK_SIZE; |
| 642 | XMALLOC_PUT_SIZE(val, size); | 642 | XMALLOC_PUT_SIZE(val, size); |
| 643 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); | 643 | memcpy (val + size, xmalloc_overrun_check_trailer, |
| 644 | XMALLOC_OVERRUN_CHECK_SIZE); | ||
| 644 | } | 645 | } |
| 645 | --check_depth; | 646 | --check_depth; |
| 646 | return (POINTER_TYPE *)val; | 647 | return (POINTER_TYPE *)val; |
| @@ -660,28 +661,29 @@ overrun_check_realloc (block, size) | |||
| 660 | 661 | ||
| 661 | if (val | 662 | if (val |
| 662 | && check_depth == 1 | 663 | && check_depth == 1 |
| 663 | && bcmp (xmalloc_overrun_check_header, | 664 | && memcmp (xmalloc_overrun_check_header, |
| 664 | val - XMALLOC_OVERRUN_CHECK_SIZE, | 665 | val - XMALLOC_OVERRUN_CHECK_SIZE, |
| 665 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) | 666 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) |
| 666 | { | 667 | { |
| 667 | size_t osize = XMALLOC_GET_SIZE (val); | 668 | size_t osize = XMALLOC_GET_SIZE (val); |
| 668 | if (bcmp (xmalloc_overrun_check_trailer, | 669 | if (memcmp (xmalloc_overrun_check_trailer, val + osize, |
| 669 | val + osize, | 670 | XMALLOC_OVERRUN_CHECK_SIZE)) |
| 670 | XMALLOC_OVERRUN_CHECK_SIZE)) | ||
| 671 | abort (); | 671 | abort (); |
| 672 | bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); | 672 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 673 | val -= XMALLOC_OVERRUN_CHECK_SIZE; | 673 | val -= XMALLOC_OVERRUN_CHECK_SIZE; |
| 674 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); | 674 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 675 | } | 675 | } |
| 676 | 676 | ||
| 677 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); | 677 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); |
| 678 | 678 | ||
| 679 | if (val && check_depth == 1) | 679 | if (val && check_depth == 1) |
| 680 | { | 680 | { |
| 681 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); | 681 | memcpy (val, xmalloc_overrun_check_header, |
| 682 | XMALLOC_OVERRUN_CHECK_SIZE - 4); | ||
| 682 | val += XMALLOC_OVERRUN_CHECK_SIZE; | 683 | val += XMALLOC_OVERRUN_CHECK_SIZE; |
| 683 | XMALLOC_PUT_SIZE(val, size); | 684 | XMALLOC_PUT_SIZE(val, size); |
| 684 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); | 685 | memcpy (val + size, xmalloc_overrun_check_trailer, |
| 686 | XMALLOC_OVERRUN_CHECK_SIZE); | ||
| 685 | } | 687 | } |
| 686 | --check_depth; | 688 | --check_depth; |
| 687 | return (POINTER_TYPE *)val; | 689 | return (POINTER_TYPE *)val; |
| @@ -698,22 +700,21 @@ overrun_check_free (block) | |||
| 698 | ++check_depth; | 700 | ++check_depth; |
| 699 | if (val | 701 | if (val |
| 700 | && check_depth == 1 | 702 | && check_depth == 1 |
| 701 | && bcmp (xmalloc_overrun_check_header, | 703 | && memcmp (xmalloc_overrun_check_header, |
| 702 | val - XMALLOC_OVERRUN_CHECK_SIZE, | 704 | val - XMALLOC_OVERRUN_CHECK_SIZE, |
| 703 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) | 705 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) |
| 704 | { | 706 | { |
| 705 | size_t osize = XMALLOC_GET_SIZE (val); | 707 | size_t osize = XMALLOC_GET_SIZE (val); |
| 706 | if (bcmp (xmalloc_overrun_check_trailer, | 708 | if (memcmp (xmalloc_overrun_check_trailer, val + osize, |
| 707 | val + osize, | 709 | XMALLOC_OVERRUN_CHECK_SIZE)) |
| 708 | XMALLOC_OVERRUN_CHECK_SIZE)) | ||
| 709 | abort (); | 710 | abort (); |
| 710 | #ifdef XMALLOC_CLEAR_FREE_MEMORY | 711 | #ifdef XMALLOC_CLEAR_FREE_MEMORY |
| 711 | val -= XMALLOC_OVERRUN_CHECK_SIZE; | 712 | val -= XMALLOC_OVERRUN_CHECK_SIZE; |
| 712 | memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2); | 713 | memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2); |
| 713 | #else | 714 | #else |
| 714 | bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); | 715 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 715 | val -= XMALLOC_OVERRUN_CHECK_SIZE; | 716 | val -= XMALLOC_OVERRUN_CHECK_SIZE; |
| 716 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); | 717 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 717 | #endif | 718 | #endif |
| 718 | } | 719 | } |
| 719 | 720 | ||
| @@ -742,8 +743,7 @@ overrun_check_free (block) | |||
| 742 | /* Like malloc but check for no memory and block interrupt input.. */ | 743 | /* Like malloc but check for no memory and block interrupt input.. */ |
| 743 | 744 | ||
| 744 | POINTER_TYPE * | 745 | POINTER_TYPE * |
| 745 | xmalloc (size) | 746 | xmalloc (size_t size) |
| 746 | size_t size; | ||
| 747 | { | 747 | { |
| 748 | register POINTER_TYPE *val; | 748 | register POINTER_TYPE *val; |
| 749 | 749 | ||
| @@ -760,9 +760,7 @@ xmalloc (size) | |||
| 760 | /* Like realloc but check for no memory and block interrupt input.. */ | 760 | /* Like realloc but check for no memory and block interrupt input.. */ |
| 761 | 761 | ||
| 762 | POINTER_TYPE * | 762 | POINTER_TYPE * |
| 763 | xrealloc (block, size) | 763 | xrealloc (POINTER_TYPE *block, size_t size) |
| 764 | POINTER_TYPE *block; | ||
| 765 | size_t size; | ||
| 766 | { | 764 | { |
| 767 | register POINTER_TYPE *val; | 765 | register POINTER_TYPE *val; |
| 768 | 766 | ||
| @@ -783,8 +781,7 @@ xrealloc (block, size) | |||
| 783 | /* Like free but block interrupt input. */ | 781 | /* Like free but block interrupt input. */ |
| 784 | 782 | ||
| 785 | void | 783 | void |
| 786 | xfree (block) | 784 | xfree (POINTER_TYPE *block) |
| 787 | POINTER_TYPE *block; | ||
| 788 | { | 785 | { |
| 789 | if (!block) | 786 | if (!block) |
| 790 | return; | 787 | return; |
| @@ -800,12 +797,11 @@ xfree (block) | |||
| 800 | /* Like strdup, but uses xmalloc. */ | 797 | /* Like strdup, but uses xmalloc. */ |
| 801 | 798 | ||
| 802 | char * | 799 | char * |
| 803 | xstrdup (s) | 800 | xstrdup (const char *s) |
| 804 | const char *s; | ||
| 805 | { | 801 | { |
| 806 | size_t len = strlen (s) + 1; | 802 | size_t len = strlen (s) + 1; |
| 807 | char *p = (char *) xmalloc (len); | 803 | char *p = (char *) xmalloc (len); |
| 808 | bcopy (s, p, len); | 804 | memcpy (p, s, len); |
| 809 | return p; | 805 | return p; |
| 810 | } | 806 | } |
| 811 | 807 | ||
| @@ -813,8 +809,7 @@ xstrdup (s) | |||
| 813 | /* Unwind for SAFE_ALLOCA */ | 809 | /* Unwind for SAFE_ALLOCA */ |
| 814 | 810 | ||
| 815 | Lisp_Object | 811 | Lisp_Object |
| 816 | safe_alloca_unwind (arg) | 812 | safe_alloca_unwind (Lisp_Object arg) |
| 817 | Lisp_Object arg; | ||
| 818 | { | 813 | { |
| 819 | register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); | 814 | register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); |
| 820 | 815 | ||
| @@ -835,9 +830,7 @@ static void *lisp_malloc_loser; | |||
| 835 | #endif | 830 | #endif |
| 836 | 831 | ||
| 837 | static POINTER_TYPE * | 832 | static POINTER_TYPE * |
| 838 | lisp_malloc (nbytes, type) | 833 | lisp_malloc (size_t nbytes, enum mem_type type) |
| 839 | size_t nbytes; | ||
| 840 | enum mem_type type; | ||
| 841 | { | 834 | { |
| 842 | register void *val; | 835 | register void *val; |
| 843 | 836 | ||
| @@ -881,8 +874,7 @@ lisp_malloc (nbytes, type) | |||
| 881 | call to lisp_malloc. */ | 874 | call to lisp_malloc. */ |
| 882 | 875 | ||
| 883 | static void | 876 | static void |
| 884 | lisp_free (block) | 877 | lisp_free (POINTER_TYPE *block) |
| 885 | POINTER_TYPE *block; | ||
| 886 | { | 878 | { |
| 887 | MALLOC_BLOCK_INPUT; | 879 | MALLOC_BLOCK_INPUT; |
| 888 | free (block); | 880 | free (block); |
| @@ -981,9 +973,7 @@ static struct ablock *free_ablock; | |||
| 981 | Alignment is on a multiple of BLOCK_ALIGN and `nbytes' has to be | 973 | Alignment is on a multiple of BLOCK_ALIGN and `nbytes' has to be |
| 982 | smaller or equal to BLOCK_BYTES. */ | 974 | smaller or equal to BLOCK_BYTES. */ |
| 983 | static POINTER_TYPE * | 975 | static POINTER_TYPE * |
| 984 | lisp_align_malloc (nbytes, type) | 976 | lisp_align_malloc (size_t nbytes, enum mem_type type) |
| 985 | size_t nbytes; | ||
| 986 | enum mem_type type; | ||
| 987 | { | 977 | { |
| 988 | void *base, *val; | 978 | void *base, *val; |
| 989 | struct ablocks *abase; | 979 | struct ablocks *abase; |
| @@ -1090,8 +1080,7 @@ lisp_align_malloc (nbytes, type) | |||
| 1090 | } | 1080 | } |
| 1091 | 1081 | ||
| 1092 | static void | 1082 | static void |
| 1093 | lisp_align_free (block) | 1083 | lisp_align_free (POINTER_TYPE *block) |
| 1094 | POINTER_TYPE *block; | ||
| 1095 | { | 1084 | { |
| 1096 | struct ablock *ablock = block; | 1085 | struct ablock *ablock = block; |
| 1097 | struct ablocks *abase = ABLOCK_ABASE (ablock); | 1086 | struct ablocks *abase = ABLOCK_ABASE (ablock); |
| @@ -1136,7 +1125,7 @@ lisp_align_free (block) | |||
| 1136 | a call to lisp_malloc. */ | 1125 | a call to lisp_malloc. */ |
| 1137 | 1126 | ||
| 1138 | struct buffer * | 1127 | struct buffer * |
| 1139 | allocate_buffer () | 1128 | allocate_buffer (void) |
| 1140 | { | 1129 | { |
| 1141 | struct buffer *b | 1130 | struct buffer *b |
| 1142 | = (struct buffer *) lisp_malloc (sizeof (struct buffer), | 1131 | = (struct buffer *) lisp_malloc (sizeof (struct buffer), |
| @@ -1164,14 +1153,14 @@ allocate_buffer () | |||
| 1164 | there's no need to block input around malloc. */ | 1153 | there's no need to block input around malloc. */ |
| 1165 | 1154 | ||
| 1166 | #ifndef DOUG_LEA_MALLOC | 1155 | #ifndef DOUG_LEA_MALLOC |
| 1167 | extern void * (*__malloc_hook) P_ ((size_t, const void *)); | 1156 | extern void * (*__malloc_hook) (size_t, const void *); |
| 1168 | extern void * (*__realloc_hook) P_ ((void *, size_t, const void *)); | 1157 | extern void * (*__realloc_hook) (void *, size_t, const void *); |
| 1169 | extern void (*__free_hook) P_ ((void *, const void *)); | 1158 | extern void (*__free_hook) (void *, const void *); |
| 1170 | /* Else declared in malloc.h, perhaps with an extra arg. */ | 1159 | /* Else declared in malloc.h, perhaps with an extra arg. */ |
| 1171 | #endif /* DOUG_LEA_MALLOC */ | 1160 | #endif /* DOUG_LEA_MALLOC */ |
| 1172 | static void * (*old_malloc_hook) P_ ((size_t, const void *)); | 1161 | static void * (*old_malloc_hook) (size_t, const void *); |
| 1173 | static void * (*old_realloc_hook) P_ ((void *, size_t, const void*)); | 1162 | static void * (*old_realloc_hook) (void *, size_t, const void*); |
| 1174 | static void (*old_free_hook) P_ ((void*, const void*)); | 1163 | static void (*old_free_hook) (void*, const void*); |
| 1175 | 1164 | ||
| 1176 | /* This function is used as the hook for free to call. */ | 1165 | /* This function is used as the hook for free to call. */ |
| 1177 | 1166 | ||
| @@ -1434,7 +1423,7 @@ static int n_interval_blocks; | |||
| 1434 | /* Initialize interval allocation. */ | 1423 | /* Initialize interval allocation. */ |
| 1435 | 1424 | ||
| 1436 | static void | 1425 | static void |
| 1437 | init_intervals () | 1426 | init_intervals (void) |
| 1438 | { | 1427 | { |
| 1439 | interval_block = NULL; | 1428 | interval_block = NULL; |
| 1440 | interval_block_index = INTERVAL_BLOCK_SIZE; | 1429 | interval_block_index = INTERVAL_BLOCK_SIZE; |
| @@ -1446,7 +1435,7 @@ init_intervals () | |||
| 1446 | /* Return a new interval. */ | 1435 | /* Return a new interval. */ |
| 1447 | 1436 | ||
| 1448 | INTERVAL | 1437 | INTERVAL |
| 1449 | make_interval () | 1438 | make_interval (void) |
| 1450 | { | 1439 | { |
| 1451 | INTERVAL val; | 1440 | INTERVAL val; |
| 1452 | 1441 | ||
| @@ -1489,9 +1478,7 @@ make_interval () | |||
| 1489 | /* Mark Lisp objects in interval I. */ | 1478 | /* Mark Lisp objects in interval I. */ |
| 1490 | 1479 | ||
| 1491 | static void | 1480 | static void |
| 1492 | mark_interval (i, dummy) | 1481 | mark_interval (register INTERVAL i, Lisp_Object dummy) |
| 1493 | register INTERVAL i; | ||
| 1494 | Lisp_Object dummy; | ||
| 1495 | { | 1482 | { |
| 1496 | eassert (!i->gcmarkbit); /* Intervals are never shared. */ | 1483 | eassert (!i->gcmarkbit); /* Intervals are never shared. */ |
| 1497 | i->gcmarkbit = 1; | 1484 | i->gcmarkbit = 1; |
| @@ -1503,8 +1490,7 @@ mark_interval (i, dummy) | |||
| 1503 | use the macro MARK_INTERVAL_TREE instead. */ | 1490 | use the macro MARK_INTERVAL_TREE instead. */ |
| 1504 | 1491 | ||
| 1505 | static void | 1492 | static void |
| 1506 | mark_interval_tree (tree) | 1493 | mark_interval_tree (register INTERVAL tree) |
| 1507 | register INTERVAL tree; | ||
| 1508 | { | 1494 | { |
| 1509 | /* No need to test if this tree has been marked already; this | 1495 | /* No need to test if this tree has been marked already; this |
| 1510 | function is always called through the MARK_INTERVAL_TREE macro, | 1496 | function is always called through the MARK_INTERVAL_TREE macro, |
| @@ -1751,7 +1737,7 @@ static char string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = | |||
| 1751 | /* Initialize string allocation. Called from init_alloc_once. */ | 1737 | /* Initialize string allocation. Called from init_alloc_once. */ |
| 1752 | 1738 | ||
| 1753 | static void | 1739 | static void |
| 1754 | init_strings () | 1740 | init_strings (void) |
| 1755 | { | 1741 | { |
| 1756 | total_strings = total_free_strings = total_string_size = 0; | 1742 | total_strings = total_free_strings = total_string_size = 0; |
| 1757 | oldest_sblock = current_sblock = large_sblocks = NULL; | 1743 | oldest_sblock = current_sblock = large_sblocks = NULL; |
| @@ -1767,8 +1753,8 @@ init_strings () | |||
| 1767 | 1753 | ||
| 1768 | static int check_string_bytes_count; | 1754 | static int check_string_bytes_count; |
| 1769 | 1755 | ||
| 1770 | static void check_string_bytes P_ ((int)); | 1756 | static void check_string_bytes (int); |
| 1771 | static void check_sblock P_ ((struct sblock *)); | 1757 | static void check_sblock (struct sblock *); |
| 1772 | 1758 | ||
| 1773 | #define CHECK_STRING_BYTES(S) STRING_BYTES (S) | 1759 | #define CHECK_STRING_BYTES(S) STRING_BYTES (S) |
| 1774 | 1760 | ||
| @@ -1873,7 +1859,7 @@ check_string_free_list () | |||
| 1873 | /* Return a new Lisp_String. */ | 1859 | /* Return a new Lisp_String. */ |
| 1874 | 1860 | ||
| 1875 | static struct Lisp_String * | 1861 | static struct Lisp_String * |
| 1876 | allocate_string () | 1862 | allocate_string (void) |
| 1877 | { | 1863 | { |
| 1878 | struct Lisp_String *s; | 1864 | struct Lisp_String *s; |
| 1879 | 1865 | ||
| @@ -1889,7 +1875,7 @@ allocate_string () | |||
| 1889 | int i; | 1875 | int i; |
| 1890 | 1876 | ||
| 1891 | b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING); | 1877 | b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING); |
| 1892 | bzero (b, sizeof *b); | 1878 | memset (b, 0, sizeof *b); |
| 1893 | b->next = string_blocks; | 1879 | b->next = string_blocks; |
| 1894 | string_blocks = b; | 1880 | string_blocks = b; |
| 1895 | ++n_string_blocks; | 1881 | ++n_string_blocks; |
| @@ -1913,7 +1899,7 @@ allocate_string () | |||
| 1913 | MALLOC_UNBLOCK_INPUT; | 1899 | MALLOC_UNBLOCK_INPUT; |
| 1914 | 1900 | ||
| 1915 | /* Probably not strictly necessary, but play it safe. */ | 1901 | /* Probably not strictly necessary, but play it safe. */ |
| 1916 | bzero (s, sizeof *s); | 1902 | memset (s, 0, sizeof *s); |
| 1917 | 1903 | ||
| 1918 | --total_free_strings; | 1904 | --total_free_strings; |
| 1919 | ++total_strings; | 1905 | ++total_strings; |
| @@ -1944,9 +1930,7 @@ allocate_string () | |||
| 1944 | S->data if it was initially non-null. */ | 1930 | S->data if it was initially non-null. */ |
| 1945 | 1931 | ||
| 1946 | void | 1932 | void |
| 1947 | allocate_string_data (s, nchars, nbytes) | 1933 | allocate_string_data (struct Lisp_String *s, int nchars, int nbytes) |
| 1948 | struct Lisp_String *s; | ||
| 1949 | int nchars, nbytes; | ||
| 1950 | { | 1934 | { |
| 1951 | struct sdata *data, *old_data; | 1935 | struct sdata *data, *old_data; |
| 1952 | struct sblock *b; | 1936 | struct sblock *b; |
| @@ -2023,8 +2007,7 @@ allocate_string_data (s, nchars, nbytes) | |||
| 2023 | s->size_byte = nbytes; | 2007 | s->size_byte = nbytes; |
| 2024 | s->data[nbytes] = '\0'; | 2008 | s->data[nbytes] = '\0'; |
| 2025 | #ifdef GC_CHECK_STRING_OVERRUN | 2009 | #ifdef GC_CHECK_STRING_OVERRUN |
| 2026 | bcopy (string_overrun_cookie, (char *) data + needed, | 2010 | memcpy (data + needed, string_overrun_cookie, GC_STRING_OVERRUN_COOKIE_SIZE); |
| 2027 | GC_STRING_OVERRUN_COOKIE_SIZE); | ||
| 2028 | #endif | 2011 | #endif |
| 2029 | 2012 | ||
| 2030 | /* If S had already data assigned, mark that as free by setting its | 2013 | /* If S had already data assigned, mark that as free by setting its |
| @@ -2043,7 +2026,7 @@ allocate_string_data (s, nchars, nbytes) | |||
| 2043 | /* Sweep and compact strings. */ | 2026 | /* Sweep and compact strings. */ |
| 2044 | 2027 | ||
| 2045 | static void | 2028 | static void |
| 2046 | sweep_strings () | 2029 | sweep_strings (void) |
| 2047 | { | 2030 | { |
| 2048 | struct string_block *b, *next; | 2031 | struct string_block *b, *next; |
| 2049 | struct string_block *live_blocks = NULL; | 2032 | struct string_block *live_blocks = NULL; |
| @@ -2143,7 +2126,7 @@ sweep_strings () | |||
| 2143 | /* Free dead large strings. */ | 2126 | /* Free dead large strings. */ |
| 2144 | 2127 | ||
| 2145 | static void | 2128 | static void |
| 2146 | free_large_strings () | 2129 | free_large_strings (void) |
| 2147 | { | 2130 | { |
| 2148 | struct sblock *b, *next; | 2131 | struct sblock *b, *next; |
| 2149 | struct sblock *live_blocks = NULL; | 2132 | struct sblock *live_blocks = NULL; |
| @@ -2169,7 +2152,7 @@ free_large_strings () | |||
| 2169 | data of live strings after compaction. */ | 2152 | data of live strings after compaction. */ |
| 2170 | 2153 | ||
| 2171 | static void | 2154 | static void |
| 2172 | compact_small_strings () | 2155 | compact_small_strings (void) |
| 2173 | { | 2156 | { |
| 2174 | struct sblock *b, *tb, *next; | 2157 | struct sblock *b, *tb, *next; |
| 2175 | struct sdata *from, *to, *end, *tb_end; | 2158 | struct sdata *from, *to, *end, *tb_end; |
| @@ -2215,9 +2198,9 @@ compact_small_strings () | |||
| 2215 | from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); | 2198 | from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); |
| 2216 | 2199 | ||
| 2217 | #ifdef GC_CHECK_STRING_OVERRUN | 2200 | #ifdef GC_CHECK_STRING_OVERRUN |
| 2218 | if (bcmp (string_overrun_cookie, | 2201 | if (memcmp (string_overrun_cookie, |
| 2219 | ((char *) from_end) - GC_STRING_OVERRUN_COOKIE_SIZE, | 2202 | (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE, |
| 2220 | GC_STRING_OVERRUN_COOKIE_SIZE)) | 2203 | GC_STRING_OVERRUN_COOKIE_SIZE)) |
| 2221 | abort (); | 2204 | abort (); |
| 2222 | #endif | 2205 | #endif |
| 2223 | 2206 | ||
| @@ -2239,7 +2222,7 @@ compact_small_strings () | |||
| 2239 | if (from != to) | 2222 | if (from != to) |
| 2240 | { | 2223 | { |
| 2241 | xassert (tb != b || to <= from); | 2224 | xassert (tb != b || to <= from); |
| 2242 | safe_bcopy ((char *) from, (char *) to, nbytes + GC_STRING_EXTRA); | 2225 | memmove (to, from, nbytes + GC_STRING_EXTRA); |
| 2243 | to->string->data = SDATA_DATA (to); | 2226 | to->string->data = SDATA_DATA (to); |
| 2244 | } | 2227 | } |
| 2245 | 2228 | ||
| @@ -2298,7 +2281,7 @@ INIT must be an integer that represents a character. */) | |||
| 2298 | end = p + nbytes; | 2281 | end = p + nbytes; |
| 2299 | while (p != end) | 2282 | while (p != end) |
| 2300 | { | 2283 | { |
| 2301 | bcopy (str, p, len); | 2284 | memcpy (p, str, len); |
| 2302 | p += len; | 2285 | p += len; |
| 2303 | } | 2286 | } |
| 2304 | } | 2287 | } |
| @@ -2357,9 +2340,7 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 2357 | multibyte, depending on the contents. */ | 2340 | multibyte, depending on the contents. */ |
| 2358 | 2341 | ||
| 2359 | Lisp_Object | 2342 | Lisp_Object |
| 2360 | make_string (contents, nbytes) | 2343 | make_string (const char *contents, int nbytes) |
| 2361 | const char *contents; | ||
| 2362 | int nbytes; | ||
| 2363 | { | 2344 | { |
| 2364 | register Lisp_Object val; | 2345 | register Lisp_Object val; |
| 2365 | int nchars, multibyte_nbytes; | 2346 | int nchars, multibyte_nbytes; |
| @@ -2378,13 +2359,11 @@ make_string (contents, nbytes) | |||
| 2378 | /* Make an unibyte string from LENGTH bytes at CONTENTS. */ | 2359 | /* Make an unibyte string from LENGTH bytes at CONTENTS. */ |
| 2379 | 2360 | ||
| 2380 | Lisp_Object | 2361 | Lisp_Object |
| 2381 | make_unibyte_string (contents, length) | 2362 | make_unibyte_string (const char *contents, int length) |
| 2382 | const char *contents; | ||
| 2383 | int length; | ||
| 2384 | { | 2363 | { |
| 2385 | register Lisp_Object val; | 2364 | register Lisp_Object val; |
| 2386 | val = make_uninit_string (length); | 2365 | val = make_uninit_string (length); |
| 2387 | bcopy (contents, SDATA (val), length); | 2366 | memcpy (SDATA (val), contents, length); |
| 2388 | STRING_SET_UNIBYTE (val); | 2367 | STRING_SET_UNIBYTE (val); |
| 2389 | return val; | 2368 | return val; |
| 2390 | } | 2369 | } |
| @@ -2394,13 +2373,11 @@ make_unibyte_string (contents, length) | |||
| 2394 | bytes at CONTENTS. */ | 2373 | bytes at CONTENTS. */ |
| 2395 | 2374 | ||
| 2396 | Lisp_Object | 2375 | Lisp_Object |
| 2397 | make_multibyte_string (contents, nchars, nbytes) | 2376 | make_multibyte_string (const char *contents, int nchars, int nbytes) |
| 2398 | const char *contents; | ||
| 2399 | int nchars, nbytes; | ||
| 2400 | { | 2377 | { |
| 2401 | register Lisp_Object val; | 2378 | register Lisp_Object val; |
| 2402 | val = make_uninit_multibyte_string (nchars, nbytes); | 2379 | val = make_uninit_multibyte_string (nchars, nbytes); |
| 2403 | bcopy (contents, SDATA (val), nbytes); | 2380 | memcpy (SDATA (val), contents, nbytes); |
| 2404 | return val; | 2381 | return val; |
| 2405 | } | 2382 | } |
| 2406 | 2383 | ||
| @@ -2409,13 +2386,11 @@ make_multibyte_string (contents, nchars, nbytes) | |||
| 2409 | CONTENTS. It is a multibyte string if NBYTES != NCHARS. */ | 2386 | CONTENTS. It is a multibyte string if NBYTES != NCHARS. */ |
| 2410 | 2387 | ||
| 2411 | Lisp_Object | 2388 | Lisp_Object |
| 2412 | make_string_from_bytes (contents, nchars, nbytes) | 2389 | make_string_from_bytes (const char *contents, int nchars, int nbytes) |
| 2413 | const char *contents; | ||
| 2414 | int nchars, nbytes; | ||
| 2415 | { | 2390 | { |
| 2416 | register Lisp_Object val; | 2391 | register Lisp_Object val; |
| 2417 | val = make_uninit_multibyte_string (nchars, nbytes); | 2392 | val = make_uninit_multibyte_string (nchars, nbytes); |
| 2418 | bcopy (contents, SDATA (val), nbytes); | 2393 | memcpy (SDATA (val), contents, nbytes); |
| 2419 | if (SBYTES (val) == SCHARS (val)) | 2394 | if (SBYTES (val) == SCHARS (val)) |
| 2420 | STRING_SET_UNIBYTE (val); | 2395 | STRING_SET_UNIBYTE (val); |
| 2421 | return val; | 2396 | return val; |
| @@ -2428,10 +2403,7 @@ make_string_from_bytes (contents, nchars, nbytes) | |||
| 2428 | characters by itself. */ | 2403 | characters by itself. */ |
| 2429 | 2404 | ||
| 2430 | Lisp_Object | 2405 | Lisp_Object |
| 2431 | make_specified_string (contents, nchars, nbytes, multibyte) | 2406 | make_specified_string (const char *contents, int nchars, int nbytes, int multibyte) |
| 2432 | const char *contents; | ||
| 2433 | int nchars, nbytes; | ||
| 2434 | int multibyte; | ||
| 2435 | { | 2407 | { |
| 2436 | register Lisp_Object val; | 2408 | register Lisp_Object val; |
| 2437 | 2409 | ||
| @@ -2443,7 +2415,7 @@ make_specified_string (contents, nchars, nbytes, multibyte) | |||
| 2443 | nchars = nbytes; | 2415 | nchars = nbytes; |
| 2444 | } | 2416 | } |
| 2445 | val = make_uninit_multibyte_string (nchars, nbytes); | 2417 | val = make_uninit_multibyte_string (nchars, nbytes); |
| 2446 | bcopy (contents, SDATA (val), nbytes); | 2418 | memcpy (SDATA (val), contents, nbytes); |
| 2447 | if (!multibyte) | 2419 | if (!multibyte) |
| 2448 | STRING_SET_UNIBYTE (val); | 2420 | STRING_SET_UNIBYTE (val); |
| 2449 | return val; | 2421 | return val; |
| @@ -2454,8 +2426,7 @@ make_specified_string (contents, nchars, nbytes, multibyte) | |||
| 2454 | data warrants. */ | 2426 | data warrants. */ |
| 2455 | 2427 | ||
| 2456 | Lisp_Object | 2428 | Lisp_Object |
| 2457 | build_string (str) | 2429 | build_string (const char *str) |
| 2458 | const char *str; | ||
| 2459 | { | 2430 | { |
| 2460 | return make_string (str, strlen (str)); | 2431 | return make_string (str, strlen (str)); |
| 2461 | } | 2432 | } |
| @@ -2465,8 +2436,7 @@ build_string (str) | |||
| 2465 | occupying LENGTH bytes. */ | 2436 | occupying LENGTH bytes. */ |
| 2466 | 2437 | ||
| 2467 | Lisp_Object | 2438 | Lisp_Object |
| 2468 | make_uninit_string (length) | 2439 | make_uninit_string (int length) |
| 2469 | int length; | ||
| 2470 | { | 2440 | { |
| 2471 | Lisp_Object val; | 2441 | Lisp_Object val; |
| 2472 | 2442 | ||
| @@ -2482,8 +2452,7 @@ make_uninit_string (length) | |||
| 2482 | which occupy NBYTES bytes. */ | 2452 | which occupy NBYTES bytes. */ |
| 2483 | 2453 | ||
| 2484 | Lisp_Object | 2454 | Lisp_Object |
| 2485 | make_uninit_multibyte_string (nchars, nbytes) | 2455 | make_uninit_multibyte_string (int nchars, int nbytes) |
| 2486 | int nchars, nbytes; | ||
| 2487 | { | 2456 | { |
| 2488 | Lisp_Object string; | 2457 | Lisp_Object string; |
| 2489 | struct Lisp_String *s; | 2458 | struct Lisp_String *s; |
| @@ -2573,7 +2542,7 @@ struct Lisp_Float *float_free_list; | |||
| 2573 | /* Initialize float allocation. */ | 2542 | /* Initialize float allocation. */ |
| 2574 | 2543 | ||
| 2575 | static void | 2544 | static void |
| 2576 | init_float () | 2545 | init_float (void) |
| 2577 | { | 2546 | { |
| 2578 | float_block = NULL; | 2547 | float_block = NULL; |
| 2579 | float_block_index = FLOAT_BLOCK_SIZE; /* Force alloc of new float_block. */ | 2548 | float_block_index = FLOAT_BLOCK_SIZE; /* Force alloc of new float_block. */ |
| @@ -2585,8 +2554,7 @@ init_float () | |||
| 2585 | /* Explicitly free a float cell by putting it on the free-list. */ | 2554 | /* Explicitly free a float cell by putting it on the free-list. */ |
| 2586 | 2555 | ||
| 2587 | static void | 2556 | static void |
| 2588 | free_float (ptr) | 2557 | free_float (struct Lisp_Float *ptr) |
| 2589 | struct Lisp_Float *ptr; | ||
| 2590 | { | 2558 | { |
| 2591 | ptr->u.chain = float_free_list; | 2559 | ptr->u.chain = float_free_list; |
| 2592 | float_free_list = ptr; | 2560 | float_free_list = ptr; |
| @@ -2596,8 +2564,7 @@ free_float (ptr) | |||
| 2596 | /* Return a new float object with value FLOAT_VALUE. */ | 2564 | /* Return a new float object with value FLOAT_VALUE. */ |
| 2597 | 2565 | ||
| 2598 | Lisp_Object | 2566 | Lisp_Object |
| 2599 | make_float (float_value) | 2567 | make_float (double float_value) |
| 2600 | double float_value; | ||
| 2601 | { | 2568 | { |
| 2602 | register Lisp_Object val; | 2569 | register Lisp_Object val; |
| 2603 | 2570 | ||
| @@ -2621,7 +2588,7 @@ make_float (float_value) | |||
| 2621 | new = (struct float_block *) lisp_align_malloc (sizeof *new, | 2588 | new = (struct float_block *) lisp_align_malloc (sizeof *new, |
| 2622 | MEM_TYPE_FLOAT); | 2589 | MEM_TYPE_FLOAT); |
| 2623 | new->next = float_block; | 2590 | new->next = float_block; |
| 2624 | bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); | 2591 | memset (new->gcmarkbits, 0, sizeof new->gcmarkbits); |
| 2625 | float_block = new; | 2592 | float_block = new; |
| 2626 | float_block_index = 0; | 2593 | float_block_index = 0; |
| 2627 | n_float_blocks++; | 2594 | n_float_blocks++; |
| @@ -2697,7 +2664,7 @@ static int n_cons_blocks; | |||
| 2697 | /* Initialize cons allocation. */ | 2664 | /* Initialize cons allocation. */ |
| 2698 | 2665 | ||
| 2699 | static void | 2666 | static void |
| 2700 | init_cons () | 2667 | init_cons (void) |
| 2701 | { | 2668 | { |
| 2702 | cons_block = NULL; | 2669 | cons_block = NULL; |
| 2703 | cons_block_index = CONS_BLOCK_SIZE; /* Force alloc of new cons_block. */ | 2670 | cons_block_index = CONS_BLOCK_SIZE; /* Force alloc of new cons_block. */ |
| @@ -2709,8 +2676,7 @@ init_cons () | |||
| 2709 | /* Explicitly free a cons cell by putting it on the free-list. */ | 2676 | /* Explicitly free a cons cell by putting it on the free-list. */ |
| 2710 | 2677 | ||
| 2711 | void | 2678 | void |
| 2712 | free_cons (ptr) | 2679 | free_cons (struct Lisp_Cons *ptr) |
| 2713 | struct Lisp_Cons *ptr; | ||
| 2714 | { | 2680 | { |
| 2715 | ptr->u.chain = cons_free_list; | 2681 | ptr->u.chain = cons_free_list; |
| 2716 | #if GC_MARK_STACK | 2682 | #if GC_MARK_STACK |
| @@ -2744,7 +2710,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 2744 | register struct cons_block *new; | 2710 | register struct cons_block *new; |
| 2745 | new = (struct cons_block *) lisp_align_malloc (sizeof *new, | 2711 | new = (struct cons_block *) lisp_align_malloc (sizeof *new, |
| 2746 | MEM_TYPE_CONS); | 2712 | MEM_TYPE_CONS); |
| 2747 | bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); | 2713 | memset (new->gcmarkbits, 0, sizeof new->gcmarkbits); |
| 2748 | new->next = cons_block; | 2714 | new->next = cons_block; |
| 2749 | cons_block = new; | 2715 | cons_block = new; |
| 2750 | cons_block_index = 0; | 2716 | cons_block_index = 0; |
| @@ -2766,7 +2732,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 2766 | 2732 | ||
| 2767 | /* Get an error now if there's any junk in the cons free list. */ | 2733 | /* Get an error now if there's any junk in the cons free list. */ |
| 2768 | void | 2734 | void |
| 2769 | check_cons_list () | 2735 | check_cons_list (void) |
| 2770 | { | 2736 | { |
| 2771 | #ifdef GC_CHECK_CONS_LIST | 2737 | #ifdef GC_CHECK_CONS_LIST |
| 2772 | struct Lisp_Cons *tail = cons_free_list; | 2738 | struct Lisp_Cons *tail = cons_free_list; |
| @@ -2779,39 +2745,34 @@ check_cons_list () | |||
| 2779 | /* Make a list of 1, 2, 3, 4 or 5 specified objects. */ | 2745 | /* Make a list of 1, 2, 3, 4 or 5 specified objects. */ |
| 2780 | 2746 | ||
| 2781 | Lisp_Object | 2747 | Lisp_Object |
| 2782 | list1 (arg1) | 2748 | list1 (Lisp_Object arg1) |
| 2783 | Lisp_Object arg1; | ||
| 2784 | { | 2749 | { |
| 2785 | return Fcons (arg1, Qnil); | 2750 | return Fcons (arg1, Qnil); |
| 2786 | } | 2751 | } |
| 2787 | 2752 | ||
| 2788 | Lisp_Object | 2753 | Lisp_Object |
| 2789 | list2 (arg1, arg2) | 2754 | list2 (Lisp_Object arg1, Lisp_Object arg2) |
| 2790 | Lisp_Object arg1, arg2; | ||
| 2791 | { | 2755 | { |
| 2792 | return Fcons (arg1, Fcons (arg2, Qnil)); | 2756 | return Fcons (arg1, Fcons (arg2, Qnil)); |
| 2793 | } | 2757 | } |
| 2794 | 2758 | ||
| 2795 | 2759 | ||
| 2796 | Lisp_Object | 2760 | Lisp_Object |
| 2797 | list3 (arg1, arg2, arg3) | 2761 | list3 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) |
| 2798 | Lisp_Object arg1, arg2, arg3; | ||
| 2799 | { | 2762 | { |
| 2800 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Qnil))); | 2763 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Qnil))); |
| 2801 | } | 2764 | } |
| 2802 | 2765 | ||
| 2803 | 2766 | ||
| 2804 | Lisp_Object | 2767 | Lisp_Object |
| 2805 | list4 (arg1, arg2, arg3, arg4) | 2768 | list4 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4) |
| 2806 | Lisp_Object arg1, arg2, arg3, arg4; | ||
| 2807 | { | 2769 | { |
| 2808 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Qnil)))); | 2770 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Qnil)))); |
| 2809 | } | 2771 | } |
| 2810 | 2772 | ||
| 2811 | 2773 | ||
| 2812 | Lisp_Object | 2774 | Lisp_Object |
| 2813 | list5 (arg1, arg2, arg3, arg4, arg5) | 2775 | list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5) |
| 2814 | Lisp_Object arg1, arg2, arg3, arg4, arg5; | ||
| 2815 | { | 2776 | { |
| 2816 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, | 2777 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, |
| 2817 | Fcons (arg5, Qnil))))); | 2778 | Fcons (arg5, Qnil))))); |
| @@ -2904,8 +2865,7 @@ static int n_vectors; | |||
| 2904 | with room for LEN Lisp_Objects. */ | 2865 | with room for LEN Lisp_Objects. */ |
| 2905 | 2866 | ||
| 2906 | static struct Lisp_Vector * | 2867 | static struct Lisp_Vector * |
| 2907 | allocate_vectorlike (len) | 2868 | allocate_vectorlike (EMACS_INT len) |
| 2908 | EMACS_INT len; | ||
| 2909 | { | 2869 | { |
| 2910 | struct Lisp_Vector *p; | 2870 | struct Lisp_Vector *p; |
| 2911 | size_t nbytes; | 2871 | size_t nbytes; |
| @@ -2946,8 +2906,7 @@ allocate_vectorlike (len) | |||
| 2946 | /* Allocate a vector with NSLOTS slots. */ | 2906 | /* Allocate a vector with NSLOTS slots. */ |
| 2947 | 2907 | ||
| 2948 | struct Lisp_Vector * | 2908 | struct Lisp_Vector * |
| 2949 | allocate_vector (nslots) | 2909 | allocate_vector (EMACS_INT nslots) |
| 2950 | EMACS_INT nslots; | ||
| 2951 | { | 2910 | { |
| 2952 | struct Lisp_Vector *v = allocate_vectorlike (nslots); | 2911 | struct Lisp_Vector *v = allocate_vectorlike (nslots); |
| 2953 | v->size = nslots; | 2912 | v->size = nslots; |
| @@ -2958,9 +2917,7 @@ allocate_vector (nslots) | |||
| 2958 | /* Allocate other vector-like structures. */ | 2917 | /* Allocate other vector-like structures. */ |
| 2959 | 2918 | ||
| 2960 | struct Lisp_Vector * | 2919 | struct Lisp_Vector * |
| 2961 | allocate_pseudovector (memlen, lisplen, tag) | 2920 | allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag) |
| 2962 | int memlen, lisplen; | ||
| 2963 | EMACS_INT tag; | ||
| 2964 | { | 2921 | { |
| 2965 | struct Lisp_Vector *v = allocate_vectorlike (memlen); | 2922 | struct Lisp_Vector *v = allocate_vectorlike (memlen); |
| 2966 | EMACS_INT i; | 2923 | EMACS_INT i; |
| @@ -2982,38 +2939,38 @@ allocate_hash_table (void) | |||
| 2982 | 2939 | ||
| 2983 | 2940 | ||
| 2984 | struct window * | 2941 | struct window * |
| 2985 | allocate_window () | 2942 | allocate_window (void) |
| 2986 | { | 2943 | { |
| 2987 | return ALLOCATE_PSEUDOVECTOR(struct window, current_matrix, PVEC_WINDOW); | 2944 | return ALLOCATE_PSEUDOVECTOR(struct window, current_matrix, PVEC_WINDOW); |
| 2988 | } | 2945 | } |
| 2989 | 2946 | ||
| 2990 | 2947 | ||
| 2991 | struct terminal * | 2948 | struct terminal * |
| 2992 | allocate_terminal () | 2949 | allocate_terminal (void) |
| 2993 | { | 2950 | { |
| 2994 | struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal, | 2951 | struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal, |
| 2995 | next_terminal, PVEC_TERMINAL); | 2952 | next_terminal, PVEC_TERMINAL); |
| 2996 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ | 2953 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ |
| 2997 | bzero (&(t->next_terminal), | 2954 | memset (&t->next_terminal, 0, |
| 2998 | ((char*)(t+1)) - ((char*)&(t->next_terminal))); | 2955 | (char*) (t + 1) - (char*) &t->next_terminal); |
| 2999 | 2956 | ||
| 3000 | return t; | 2957 | return t; |
| 3001 | } | 2958 | } |
| 3002 | 2959 | ||
| 3003 | struct frame * | 2960 | struct frame * |
| 3004 | allocate_frame () | 2961 | allocate_frame (void) |
| 3005 | { | 2962 | { |
| 3006 | struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame, | 2963 | struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame, |
| 3007 | face_cache, PVEC_FRAME); | 2964 | face_cache, PVEC_FRAME); |
| 3008 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ | 2965 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ |
| 3009 | bzero (&(f->face_cache), | 2966 | memset (&f->face_cache, 0, |
| 3010 | ((char*)(f+1)) - ((char*)&(f->face_cache))); | 2967 | (char *) (f + 1) - (char *) &f->face_cache); |
| 3011 | return f; | 2968 | return f; |
| 3012 | } | 2969 | } |
| 3013 | 2970 | ||
| 3014 | 2971 | ||
| 3015 | struct Lisp_Process * | 2972 | struct Lisp_Process * |
| 3016 | allocate_process () | 2973 | allocate_process (void) |
| 3017 | { | 2974 | { |
| 3018 | return ALLOCATE_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS); | 2975 | return ALLOCATE_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS); |
| 3019 | } | 2976 | } |
| @@ -3142,7 +3099,7 @@ static int n_symbol_blocks; | |||
| 3142 | /* Initialize symbol allocation. */ | 3099 | /* Initialize symbol allocation. */ |
| 3143 | 3100 | ||
| 3144 | static void | 3101 | static void |
| 3145 | init_symbol () | 3102 | init_symbol (void) |
| 3146 | { | 3103 | { |
| 3147 | symbol_block = NULL; | 3104 | symbol_block = NULL; |
| 3148 | symbol_block_index = SYMBOL_BLOCK_SIZE; | 3105 | symbol_block_index = SYMBOL_BLOCK_SIZE; |
| @@ -3233,7 +3190,7 @@ static union Lisp_Misc *marker_free_list; | |||
| 3233 | static int n_marker_blocks; | 3190 | static int n_marker_blocks; |
| 3234 | 3191 | ||
| 3235 | static void | 3192 | static void |
| 3236 | init_marker () | 3193 | init_marker (void) |
| 3237 | { | 3194 | { |
| 3238 | marker_block = NULL; | 3195 | marker_block = NULL; |
| 3239 | marker_block_index = MARKER_BLOCK_SIZE; | 3196 | marker_block_index = MARKER_BLOCK_SIZE; |
| @@ -3244,7 +3201,7 @@ init_marker () | |||
| 3244 | /* Return a newly allocated Lisp_Misc object, with no substructure. */ | 3201 | /* Return a newly allocated Lisp_Misc object, with no substructure. */ |
| 3245 | 3202 | ||
| 3246 | Lisp_Object | 3203 | Lisp_Object |
| 3247 | allocate_misc () | 3204 | allocate_misc (void) |
| 3248 | { | 3205 | { |
| 3249 | Lisp_Object val; | 3206 | Lisp_Object val; |
| 3250 | 3207 | ||
| @@ -3286,8 +3243,7 @@ allocate_misc () | |||
| 3286 | /* Free a Lisp_Misc object */ | 3243 | /* Free a Lisp_Misc object */ |
| 3287 | 3244 | ||
| 3288 | void | 3245 | void |
| 3289 | free_misc (misc) | 3246 | free_misc (Lisp_Object misc) |
| 3290 | Lisp_Object misc; | ||
| 3291 | { | 3247 | { |
| 3292 | XMISCTYPE (misc) = Lisp_Misc_Free; | 3248 | XMISCTYPE (misc) = Lisp_Misc_Free; |
| 3293 | XMISC (misc)->u_free.chain = marker_free_list; | 3249 | XMISC (misc)->u_free.chain = marker_free_list; |
| @@ -3301,9 +3257,7 @@ free_misc (misc) | |||
| 3301 | The unwind function can get the C values back using XSAVE_VALUE. */ | 3257 | The unwind function can get the C values back using XSAVE_VALUE. */ |
| 3302 | 3258 | ||
| 3303 | Lisp_Object | 3259 | Lisp_Object |
| 3304 | make_save_value (pointer, integer) | 3260 | make_save_value (void *pointer, int integer) |
| 3305 | void *pointer; | ||
| 3306 | int integer; | ||
| 3307 | { | 3261 | { |
| 3308 | register Lisp_Object val; | 3262 | register Lisp_Object val; |
| 3309 | register struct Lisp_Save_Value *p; | 3263 | register struct Lisp_Save_Value *p; |
| @@ -3338,8 +3292,7 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, | |||
| 3338 | /* Put MARKER back on the free list after using it temporarily. */ | 3292 | /* Put MARKER back on the free list after using it temporarily. */ |
| 3339 | 3293 | ||
| 3340 | void | 3294 | void |
| 3341 | free_marker (marker) | 3295 | free_marker (Lisp_Object marker) |
| 3342 | Lisp_Object marker; | ||
| 3343 | { | 3296 | { |
| 3344 | unchain_marker (XMARKER (marker)); | 3297 | unchain_marker (XMARKER (marker)); |
| 3345 | free_misc (marker); | 3298 | free_misc (marker); |
| @@ -3353,9 +3306,7 @@ free_marker (marker) | |||
| 3353 | Any number of arguments, even zero arguments, are allowed. */ | 3306 | Any number of arguments, even zero arguments, are allowed. */ |
| 3354 | 3307 | ||
| 3355 | Lisp_Object | 3308 | Lisp_Object |
| 3356 | make_event_array (nargs, args) | 3309 | make_event_array (register int nargs, Lisp_Object *args) |
| 3357 | register int nargs; | ||
| 3358 | Lisp_Object *args; | ||
| 3359 | { | 3310 | { |
| 3360 | int i; | 3311 | int i; |
| 3361 | 3312 | ||
| @@ -3395,7 +3346,7 @@ make_event_array (nargs, args) | |||
| 3395 | /* Called if malloc returns zero. */ | 3346 | /* Called if malloc returns zero. */ |
| 3396 | 3347 | ||
| 3397 | void | 3348 | void |
| 3398 | memory_full () | 3349 | memory_full (void) |
| 3399 | { | 3350 | { |
| 3400 | int i; | 3351 | int i; |
| 3401 | 3352 | ||
| @@ -3435,7 +3386,7 @@ memory_full () | |||
| 3435 | and also directly from this file, in case we're not using ralloc.c. */ | 3386 | and also directly from this file, in case we're not using ralloc.c. */ |
| 3436 | 3387 | ||
| 3437 | void | 3388 | void |
| 3438 | refill_memory_reserve () | 3389 | refill_memory_reserve (void) |
| 3439 | { | 3390 | { |
| 3440 | #ifndef SYSTEM_MALLOC | 3391 | #ifndef SYSTEM_MALLOC |
| 3441 | if (spare_memory[0] == 0) | 3392 | if (spare_memory[0] == 0) |
| @@ -3483,7 +3434,7 @@ refill_memory_reserve () | |||
| 3483 | /* Initialize this part of alloc.c. */ | 3434 | /* Initialize this part of alloc.c. */ |
| 3484 | 3435 | ||
| 3485 | static void | 3436 | static void |
| 3486 | mem_init () | 3437 | mem_init (void) |
| 3487 | { | 3438 | { |
| 3488 | mem_z.left = mem_z.right = MEM_NIL; | 3439 | mem_z.left = mem_z.right = MEM_NIL; |
| 3489 | mem_z.parent = NULL; | 3440 | mem_z.parent = NULL; |
| @@ -3497,8 +3448,7 @@ mem_init () | |||
| 3497 | MEM_NIL if there is no node in the tree containing START. */ | 3448 | MEM_NIL if there is no node in the tree containing START. */ |
| 3498 | 3449 | ||
| 3499 | static INLINE struct mem_node * | 3450 | static INLINE struct mem_node * |
| 3500 | mem_find (start) | 3451 | mem_find (void *start) |
| 3501 | void *start; | ||
| 3502 | { | 3452 | { |
| 3503 | struct mem_node *p; | 3453 | struct mem_node *p; |
| 3504 | 3454 | ||
| @@ -3521,9 +3471,7 @@ mem_find (start) | |||
| 3521 | pointer to the node that was inserted. */ | 3471 | pointer to the node that was inserted. */ |
| 3522 | 3472 | ||
| 3523 | static struct mem_node * | 3473 | static struct mem_node * |
| 3524 | mem_insert (start, end, type) | 3474 | mem_insert (void *start, void *end, enum mem_type type) |
| 3525 | void *start, *end; | ||
| 3526 | enum mem_type type; | ||
| 3527 | { | 3475 | { |
| 3528 | struct mem_node *c, *parent, *x; | 3476 | struct mem_node *c, *parent, *x; |
| 3529 | 3477 | ||
| @@ -3595,8 +3543,7 @@ mem_insert (start, end, type) | |||
| 3595 | balance the tree, after node X has been inserted; X is always red. */ | 3543 | balance the tree, after node X has been inserted; X is always red. */ |
| 3596 | 3544 | ||
| 3597 | static void | 3545 | static void |
| 3598 | mem_insert_fixup (x) | 3546 | mem_insert_fixup (struct mem_node *x) |
| 3599 | struct mem_node *x; | ||
| 3600 | { | 3547 | { |
| 3601 | while (x != mem_root && x->parent->color == MEM_RED) | 3548 | while (x != mem_root && x->parent->color == MEM_RED) |
| 3602 | { | 3549 | { |
| @@ -3674,8 +3621,7 @@ mem_insert_fixup (x) | |||
| 3674 | b c a b */ | 3621 | b c a b */ |
| 3675 | 3622 | ||
| 3676 | static void | 3623 | static void |
| 3677 | mem_rotate_left (x) | 3624 | mem_rotate_left (struct mem_node *x) |
| 3678 | struct mem_node *x; | ||
| 3679 | { | 3625 | { |
| 3680 | struct mem_node *y; | 3626 | struct mem_node *y; |
| 3681 | 3627 | ||
| @@ -3714,8 +3660,7 @@ mem_rotate_left (x) | |||
| 3714 | a b b c */ | 3660 | a b b c */ |
| 3715 | 3661 | ||
| 3716 | static void | 3662 | static void |
| 3717 | mem_rotate_right (x) | 3663 | mem_rotate_right (struct mem_node *x) |
| 3718 | struct mem_node *x; | ||
| 3719 | { | 3664 | { |
| 3720 | struct mem_node *y = x->left; | 3665 | struct mem_node *y = x->left; |
| 3721 | 3666 | ||
| @@ -3744,8 +3689,7 @@ mem_rotate_right (x) | |||
| 3744 | /* Delete node Z from the tree. If Z is null or MEM_NIL, do nothing. */ | 3689 | /* Delete node Z from the tree. If Z is null or MEM_NIL, do nothing. */ |
| 3745 | 3690 | ||
| 3746 | static void | 3691 | static void |
| 3747 | mem_delete (z) | 3692 | mem_delete (struct mem_node *z) |
| 3748 | struct mem_node *z; | ||
| 3749 | { | 3693 | { |
| 3750 | struct mem_node *x, *y; | 3694 | struct mem_node *x, *y; |
| 3751 | 3695 | ||
| @@ -3799,8 +3743,7 @@ mem_delete (z) | |||
| 3799 | deletion. */ | 3743 | deletion. */ |
| 3800 | 3744 | ||
| 3801 | static void | 3745 | static void |
| 3802 | mem_delete_fixup (x) | 3746 | mem_delete_fixup (struct mem_node *x) |
| 3803 | struct mem_node *x; | ||
| 3804 | { | 3747 | { |
| 3805 | while (x != mem_root && x->color == MEM_BLACK) | 3748 | while (x != mem_root && x->color == MEM_BLACK) |
| 3806 | { | 3749 | { |
| @@ -3881,9 +3824,7 @@ mem_delete_fixup (x) | |||
| 3881 | the heap. M is a pointer to the mem_block for P. */ | 3824 | the heap. M is a pointer to the mem_block for P. */ |
| 3882 | 3825 | ||
| 3883 | static INLINE int | 3826 | static INLINE int |
| 3884 | live_string_p (m, p) | 3827 | live_string_p (struct mem_node *m, void *p) |
| 3885 | struct mem_node *m; | ||
| 3886 | void *p; | ||
| 3887 | { | 3828 | { |
| 3888 | if (m->type == MEM_TYPE_STRING) | 3829 | if (m->type == MEM_TYPE_STRING) |
| 3889 | { | 3830 | { |
| @@ -3906,9 +3847,7 @@ live_string_p (m, p) | |||
| 3906 | the heap. M is a pointer to the mem_block for P. */ | 3847 | the heap. M is a pointer to the mem_block for P. */ |
| 3907 | 3848 | ||
| 3908 | static INLINE int | 3849 | static INLINE int |
| 3909 | live_cons_p (m, p) | 3850 | live_cons_p (struct mem_node *m, void *p) |
| 3910 | struct mem_node *m; | ||
| 3911 | void *p; | ||
| 3912 | { | 3851 | { |
| 3913 | if (m->type == MEM_TYPE_CONS) | 3852 | if (m->type == MEM_TYPE_CONS) |
| 3914 | { | 3853 | { |
| @@ -3934,9 +3873,7 @@ live_cons_p (m, p) | |||
| 3934 | the heap. M is a pointer to the mem_block for P. */ | 3873 | the heap. M is a pointer to the mem_block for P. */ |
| 3935 | 3874 | ||
| 3936 | static INLINE int | 3875 | static INLINE int |
| 3937 | live_symbol_p (m, p) | 3876 | live_symbol_p (struct mem_node *m, void *p) |
| 3938 | struct mem_node *m; | ||
| 3939 | void *p; | ||
| 3940 | { | 3877 | { |
| 3941 | if (m->type == MEM_TYPE_SYMBOL) | 3878 | if (m->type == MEM_TYPE_SYMBOL) |
| 3942 | { | 3879 | { |
| @@ -3962,9 +3899,7 @@ live_symbol_p (m, p) | |||
| 3962 | the heap. M is a pointer to the mem_block for P. */ | 3899 | the heap. M is a pointer to the mem_block for P. */ |
| 3963 | 3900 | ||
| 3964 | static INLINE int | 3901 | static INLINE int |
| 3965 | live_float_p (m, p) | 3902 | live_float_p (struct mem_node *m, void *p) |
| 3966 | struct mem_node *m; | ||
| 3967 | void *p; | ||
| 3968 | { | 3903 | { |
| 3969 | if (m->type == MEM_TYPE_FLOAT) | 3904 | if (m->type == MEM_TYPE_FLOAT) |
| 3970 | { | 3905 | { |
| @@ -3988,9 +3923,7 @@ live_float_p (m, p) | |||
| 3988 | the heap. M is a pointer to the mem_block for P. */ | 3923 | the heap. M is a pointer to the mem_block for P. */ |
| 3989 | 3924 | ||
| 3990 | static INLINE int | 3925 | static INLINE int |
| 3991 | live_misc_p (m, p) | 3926 | live_misc_p (struct mem_node *m, void *p) |
| 3992 | struct mem_node *m; | ||
| 3993 | void *p; | ||
| 3994 | { | 3927 | { |
| 3995 | if (m->type == MEM_TYPE_MISC) | 3928 | if (m->type == MEM_TYPE_MISC) |
| 3996 | { | 3929 | { |
| @@ -4016,9 +3949,7 @@ live_misc_p (m, p) | |||
| 4016 | M is a pointer to the mem_block for P. */ | 3949 | M is a pointer to the mem_block for P. */ |
| 4017 | 3950 | ||
| 4018 | static INLINE int | 3951 | static INLINE int |
| 4019 | live_vector_p (m, p) | 3952 | live_vector_p (struct mem_node *m, void *p) |
| 4020 | struct mem_node *m; | ||
| 4021 | void *p; | ||
| 4022 | { | 3953 | { |
| 4023 | return (p == m->start && m->type == MEM_TYPE_VECTORLIKE); | 3954 | return (p == m->start && m->type == MEM_TYPE_VECTORLIKE); |
| 4024 | } | 3955 | } |
| @@ -4028,9 +3959,7 @@ live_vector_p (m, p) | |||
| 4028 | pointer to the mem_block for P. */ | 3959 | pointer to the mem_block for P. */ |
| 4029 | 3960 | ||
| 4030 | static INLINE int | 3961 | static INLINE int |
| 4031 | live_buffer_p (m, p) | 3962 | live_buffer_p (struct mem_node *m, void *p) |
| 4032 | struct mem_node *m; | ||
| 4033 | void *p; | ||
| 4034 | { | 3963 | { |
| 4035 | /* P must point to the start of the block, and the buffer | 3964 | /* P must point to the start of the block, and the buffer |
| 4036 | must not have been killed. */ | 3965 | must not have been killed. */ |
| @@ -4096,8 +4025,7 @@ DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", | |||
| 4096 | /* Mark OBJ if we can prove it's a Lisp_Object. */ | 4025 | /* Mark OBJ if we can prove it's a Lisp_Object. */ |
| 4097 | 4026 | ||
| 4098 | static INLINE void | 4027 | static INLINE void |
| 4099 | mark_maybe_object (obj) | 4028 | mark_maybe_object (Lisp_Object obj) |
| 4100 | Lisp_Object obj; | ||
| 4101 | { | 4029 | { |
| 4102 | void *po = (void *) XPNTR (obj); | 4030 | void *po = (void *) XPNTR (obj); |
| 4103 | struct mem_node *m = mem_find (po); | 4031 | struct mem_node *m = mem_find (po); |
| @@ -4160,8 +4088,7 @@ mark_maybe_object (obj) | |||
| 4160 | marked. */ | 4088 | marked. */ |
| 4161 | 4089 | ||
| 4162 | static INLINE void | 4090 | static INLINE void |
| 4163 | mark_maybe_pointer (p) | 4091 | mark_maybe_pointer (void *p) |
| 4164 | void *p; | ||
| 4165 | { | 4092 | { |
| 4166 | struct mem_node *m; | 4093 | struct mem_node *m; |
| 4167 | 4094 | ||
| @@ -4241,9 +4168,7 @@ mark_maybe_pointer (p) | |||
| 4241 | or END+OFFSET..START. */ | 4168 | or END+OFFSET..START. */ |
| 4242 | 4169 | ||
| 4243 | static void | 4170 | static void |
| 4244 | mark_memory (start, end, offset) | 4171 | mark_memory (void *start, void *end, int offset) |
| 4245 | void *start, *end; | ||
| 4246 | int offset; | ||
| 4247 | { | 4172 | { |
| 4248 | Lisp_Object *p; | 4173 | Lisp_Object *p; |
| 4249 | void **pp; | 4174 | void **pp; |
| @@ -4459,7 +4384,7 @@ dump_zombies () | |||
| 4459 | equally on the stack. */ | 4384 | equally on the stack. */ |
| 4460 | 4385 | ||
| 4461 | static void | 4386 | static void |
| 4462 | mark_stack () | 4387 | mark_stack (void) |
| 4463 | { | 4388 | { |
| 4464 | int i; | 4389 | int i; |
| 4465 | /* jmp_buf may not be aligned enough on darwin-ppc64 */ | 4390 | /* jmp_buf may not be aligned enough on darwin-ppc64 */ |
| @@ -4534,8 +4459,7 @@ mark_stack () | |||
| 4534 | 4459 | ||
| 4535 | /* Determine whether it is safe to access memory at address P. */ | 4460 | /* Determine whether it is safe to access memory at address P. */ |
| 4536 | static int | 4461 | static int |
| 4537 | valid_pointer_p (p) | 4462 | valid_pointer_p (void *p) |
| 4538 | void *p; | ||
| 4539 | { | 4463 | { |
| 4540 | #ifdef WINDOWSNT | 4464 | #ifdef WINDOWSNT |
| 4541 | return w32_valid_pointer_p (p, 16); | 4465 | return w32_valid_pointer_p (p, 16); |
| @@ -4566,8 +4490,7 @@ valid_pointer_p (p) | |||
| 4566 | so it should only be used in code for manual debugging. */ | 4490 | so it should only be used in code for manual debugging. */ |
| 4567 | 4491 | ||
| 4568 | int | 4492 | int |
| 4569 | valid_lisp_object_p (obj) | 4493 | valid_lisp_object_p (Lisp_Object obj) |
| 4570 | Lisp_Object obj; | ||
| 4571 | { | 4494 | { |
| 4572 | void *p; | 4495 | void *p; |
| 4573 | #if GC_MARK_STACK | 4496 | #if GC_MARK_STACK |
| @@ -4645,9 +4568,7 @@ valid_lisp_object_p (obj) | |||
| 4645 | allocated. TYPE < 0 means it's not used for a Lisp object. */ | 4568 | allocated. TYPE < 0 means it's not used for a Lisp object. */ |
| 4646 | 4569 | ||
| 4647 | static POINTER_TYPE * | 4570 | static POINTER_TYPE * |
| 4648 | pure_alloc (size, type) | 4571 | pure_alloc (size_t size, int type) |
| 4649 | size_t size; | ||
| 4650 | int type; | ||
| 4651 | { | 4572 | { |
| 4652 | POINTER_TYPE *result; | 4573 | POINTER_TYPE *result; |
| 4653 | #ifdef USE_LSB_TAG | 4574 | #ifdef USE_LSB_TAG |
| @@ -4701,7 +4622,7 @@ pure_alloc (size, type) | |||
| 4701 | /* Print a warning if PURESIZE is too small. */ | 4622 | /* Print a warning if PURESIZE is too small. */ |
| 4702 | 4623 | ||
| 4703 | void | 4624 | void |
| 4704 | check_pure_size () | 4625 | check_pure_size (void) |
| 4705 | { | 4626 | { |
| 4706 | if (pure_bytes_used_before_overflow) | 4627 | if (pure_bytes_used_before_overflow) |
| 4707 | message ("emacs:0:Pure Lisp storage overflow (approx. %d bytes needed)", | 4628 | message ("emacs:0:Pure Lisp storage overflow (approx. %d bytes needed)", |
| @@ -4714,9 +4635,7 @@ check_pure_size () | |||
| 4714 | address. Return NULL if not found. */ | 4635 | address. Return NULL if not found. */ |
| 4715 | 4636 | ||
| 4716 | static char * | 4637 | static char * |
| 4717 | find_string_data_in_pure (data, nbytes) | 4638 | find_string_data_in_pure (const char *data, int nbytes) |
| 4718 | const char *data; | ||
| 4719 | int nbytes; | ||
| 4720 | { | 4639 | { |
| 4721 | int i, skip, bm_skip[256], last_char_skip, infinity, start, start_max; | 4640 | int i, skip, bm_skip[256], last_char_skip, infinity, start, start_max; |
| 4722 | const unsigned char *p; | 4641 | const unsigned char *p; |
| @@ -4785,10 +4704,7 @@ find_string_data_in_pure (data, nbytes) | |||
| 4785 | string; then the string is not protected from gc. */ | 4704 | string; then the string is not protected from gc. */ |
| 4786 | 4705 | ||
| 4787 | Lisp_Object | 4706 | Lisp_Object |
| 4788 | make_pure_string (data, nchars, nbytes, multibyte) | 4707 | make_pure_string (const char *data, int nchars, int nbytes, int multibyte) |
| 4789 | const char *data; | ||
| 4790 | int nchars, nbytes; | ||
| 4791 | int multibyte; | ||
| 4792 | { | 4708 | { |
| 4793 | Lisp_Object string; | 4709 | Lisp_Object string; |
| 4794 | struct Lisp_String *s; | 4710 | struct Lisp_String *s; |
| @@ -4798,7 +4714,7 @@ make_pure_string (data, nchars, nbytes, multibyte) | |||
| 4798 | if (s->data == NULL) | 4714 | if (s->data == NULL) |
| 4799 | { | 4715 | { |
| 4800 | s->data = (unsigned char *) pure_alloc (nbytes + 1, -1); | 4716 | s->data = (unsigned char *) pure_alloc (nbytes + 1, -1); |
| 4801 | bcopy (data, s->data, nbytes); | 4717 | memcpy (s->data, data, nbytes); |
| 4802 | s->data[nbytes] = '\0'; | 4718 | s->data[nbytes] = '\0'; |
| 4803 | } | 4719 | } |
| 4804 | s->size = nchars; | 4720 | s->size = nchars; |
| @@ -4831,8 +4747,7 @@ make_pure_c_string (const char *data) | |||
| 4831 | of CAR as car and CDR as cdr. */ | 4747 | of CAR as car and CDR as cdr. */ |
| 4832 | 4748 | ||
| 4833 | Lisp_Object | 4749 | Lisp_Object |
| 4834 | pure_cons (car, cdr) | 4750 | pure_cons (Lisp_Object car, Lisp_Object cdr) |
| 4835 | Lisp_Object car, cdr; | ||
| 4836 | { | 4751 | { |
| 4837 | register Lisp_Object new; | 4752 | register Lisp_Object new; |
| 4838 | struct Lisp_Cons *p; | 4753 | struct Lisp_Cons *p; |
| @@ -4848,8 +4763,7 @@ pure_cons (car, cdr) | |||
| 4848 | /* Value is a float object with value NUM allocated from pure space. */ | 4763 | /* Value is a float object with value NUM allocated from pure space. */ |
| 4849 | 4764 | ||
| 4850 | static Lisp_Object | 4765 | static Lisp_Object |
| 4851 | make_pure_float (num) | 4766 | make_pure_float (double num) |
| 4852 | double num; | ||
| 4853 | { | 4767 | { |
| 4854 | register Lisp_Object new; | 4768 | register Lisp_Object new; |
| 4855 | struct Lisp_Float *p; | 4769 | struct Lisp_Float *p; |
| @@ -4865,8 +4779,7 @@ make_pure_float (num) | |||
| 4865 | pure space. */ | 4779 | pure space. */ |
| 4866 | 4780 | ||
| 4867 | Lisp_Object | 4781 | Lisp_Object |
| 4868 | make_pure_vector (len) | 4782 | make_pure_vector (EMACS_INT len) |
| 4869 | EMACS_INT len; | ||
| 4870 | { | 4783 | { |
| 4871 | Lisp_Object new; | 4784 | Lisp_Object new; |
| 4872 | struct Lisp_Vector *p; | 4785 | struct Lisp_Vector *p; |
| @@ -4949,8 +4862,7 @@ Does not copy symbols. Copies strings without text properties. */) | |||
| 4949 | VARADDRESS. */ | 4862 | VARADDRESS. */ |
| 4950 | 4863 | ||
| 4951 | void | 4864 | void |
| 4952 | staticpro (varaddress) | 4865 | staticpro (Lisp_Object *varaddress) |
| 4953 | Lisp_Object *varaddress; | ||
| 4954 | { | 4866 | { |
| 4955 | staticvec[staticidx++] = varaddress; | 4867 | staticvec[staticidx++] = varaddress; |
| 4956 | if (staticidx >= NSTATICS) | 4868 | if (staticidx >= NSTATICS) |
| @@ -4965,7 +4877,7 @@ staticpro (varaddress) | |||
| 4965 | /* Temporarily prevent garbage collection. */ | 4877 | /* Temporarily prevent garbage collection. */ |
| 4966 | 4878 | ||
| 4967 | int | 4879 | int |
| 4968 | inhibit_garbage_collection () | 4880 | inhibit_garbage_collection (void) |
| 4969 | { | 4881 | { |
| 4970 | int count = SPECPDL_INDEX (); | 4882 | int count = SPECPDL_INDEX (); |
| 4971 | int nbits = min (VALBITS, BITS_PER_INT); | 4883 | int nbits = min (VALBITS, BITS_PER_INT); |
| @@ -5069,9 +4981,9 @@ returns nil, because real GC can't be done. */) | |||
| 5069 | if (stack_copy) | 4981 | if (stack_copy) |
| 5070 | { | 4982 | { |
| 5071 | if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) | 4983 | if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) |
| 5072 | bcopy (stack_bottom, stack_copy, i); | 4984 | memcpy (stack_copy, stack_bottom, i); |
| 5073 | else | 4985 | else |
| 5074 | bcopy (&stack_top_variable, stack_copy, i); | 4986 | memcpy (stack_copy, &stack_top_variable, i); |
| 5075 | } | 4987 | } |
| 5076 | } | 4988 | } |
| 5077 | } | 4989 | } |
| @@ -5104,7 +5016,7 @@ returns nil, because real GC can't be done. */) | |||
| 5104 | 5016 | ||
| 5105 | #ifdef USE_GTK | 5017 | #ifdef USE_GTK |
| 5106 | { | 5018 | { |
| 5107 | extern void xg_mark_data (); | 5019 | extern void xg_mark_data (void); |
| 5108 | xg_mark_data (); | 5020 | xg_mark_data (); |
| 5109 | } | 5021 | } |
| 5110 | #endif | 5022 | #endif |
| @@ -5297,8 +5209,7 @@ returns nil, because real GC can't be done. */) | |||
| 5297 | only interesting objects referenced from glyphs are strings. */ | 5209 | only interesting objects referenced from glyphs are strings. */ |
| 5298 | 5210 | ||
| 5299 | static void | 5211 | static void |
| 5300 | mark_glyph_matrix (matrix) | 5212 | mark_glyph_matrix (struct glyph_matrix *matrix) |
| 5301 | struct glyph_matrix *matrix; | ||
| 5302 | { | 5213 | { |
| 5303 | struct glyph_row *row = matrix->rows; | 5214 | struct glyph_row *row = matrix->rows; |
| 5304 | struct glyph_row *end = row + matrix->nrows; | 5215 | struct glyph_row *end = row + matrix->nrows; |
| @@ -5324,8 +5235,7 @@ mark_glyph_matrix (matrix) | |||
| 5324 | /* Mark Lisp faces in the face cache C. */ | 5235 | /* Mark Lisp faces in the face cache C. */ |
| 5325 | 5236 | ||
| 5326 | static void | 5237 | static void |
| 5327 | mark_face_cache (c) | 5238 | mark_face_cache (struct face_cache *c) |
| 5328 | struct face_cache *c; | ||
| 5329 | { | 5239 | { |
| 5330 | if (c) | 5240 | if (c) |
| 5331 | { | 5241 | { |
| @@ -5360,8 +5270,7 @@ int last_marked_index; | |||
| 5360 | static int mark_object_loop_halt; | 5270 | static int mark_object_loop_halt; |
| 5361 | 5271 | ||
| 5362 | static void | 5272 | static void |
| 5363 | mark_vectorlike (ptr) | 5273 | mark_vectorlike (struct Lisp_Vector *ptr) |
| 5364 | struct Lisp_Vector *ptr; | ||
| 5365 | { | 5274 | { |
| 5366 | register EMACS_INT size = ptr->size; | 5275 | register EMACS_INT size = ptr->size; |
| 5367 | register int i; | 5276 | register int i; |
| @@ -5384,8 +5293,7 @@ mark_vectorlike (ptr) | |||
| 5384 | symbols. */ | 5293 | symbols. */ |
| 5385 | 5294 | ||
| 5386 | static void | 5295 | static void |
| 5387 | mark_char_table (ptr) | 5296 | mark_char_table (struct Lisp_Vector *ptr) |
| 5388 | struct Lisp_Vector *ptr; | ||
| 5389 | { | 5297 | { |
| 5390 | register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK; | 5298 | register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK; |
| 5391 | register int i; | 5299 | register int i; |
| @@ -5409,8 +5317,7 @@ mark_char_table (ptr) | |||
| 5409 | } | 5317 | } |
| 5410 | 5318 | ||
| 5411 | void | 5319 | void |
| 5412 | mark_object (arg) | 5320 | mark_object (Lisp_Object arg) |
| 5413 | Lisp_Object arg; | ||
| 5414 | { | 5321 | { |
| 5415 | register Lisp_Object obj = arg; | 5322 | register Lisp_Object obj = arg; |
| 5416 | #ifdef GC_CHECK_MARKED_OBJECTS | 5323 | #ifdef GC_CHECK_MARKED_OBJECTS |
| @@ -5719,8 +5626,7 @@ mark_object (arg) | |||
| 5719 | /* Mark the pointers in a buffer structure. */ | 5626 | /* Mark the pointers in a buffer structure. */ |
| 5720 | 5627 | ||
| 5721 | static void | 5628 | static void |
| 5722 | mark_buffer (buf) | 5629 | mark_buffer (Lisp_Object buf) |
| 5723 | Lisp_Object buf; | ||
| 5724 | { | 5630 | { |
| 5725 | register struct buffer *buffer = XBUFFER (buf); | 5631 | register struct buffer *buffer = XBUFFER (buf); |
| 5726 | register Lisp_Object *ptr, tmp; | 5632 | register Lisp_Object *ptr, tmp; |
| @@ -5787,8 +5693,7 @@ mark_terminals (void) | |||
| 5787 | either marked or does not need to be marked to survive. */ | 5693 | either marked or does not need to be marked to survive. */ |
| 5788 | 5694 | ||
| 5789 | int | 5695 | int |
| 5790 | survives_gc_p (obj) | 5696 | survives_gc_p (Lisp_Object obj) |
| 5791 | Lisp_Object obj; | ||
| 5792 | { | 5697 | { |
| 5793 | int survives_p; | 5698 | int survives_p; |
| 5794 | 5699 | ||
| @@ -5834,7 +5739,7 @@ survives_gc_p (obj) | |||
| 5834 | /* Sweep: find all structures not marked, and free them. */ | 5739 | /* Sweep: find all structures not marked, and free them. */ |
| 5835 | 5740 | ||
| 5836 | static void | 5741 | static void |
| 5837 | gc_sweep () | 5742 | gc_sweep (void) |
| 5838 | { | 5743 | { |
| 5839 | /* Remove or mark entries in weak hash tables. | 5744 | /* Remove or mark entries in weak hash tables. |
| 5840 | This must be done before any object is unmarked. */ | 5745 | This must be done before any object is unmarked. */ |
| @@ -6251,10 +6156,7 @@ Frames, windows, buffers, and subprocesses count as vectors | |||
| 6251 | int suppress_checking; | 6156 | int suppress_checking; |
| 6252 | 6157 | ||
| 6253 | void | 6158 | void |
| 6254 | die (msg, file, line) | 6159 | die (const char *msg, const char *file, int line) |
| 6255 | const char *msg; | ||
| 6256 | const char *file; | ||
| 6257 | int line; | ||
| 6258 | { | 6160 | { |
| 6259 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", | 6161 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", |
| 6260 | file, line, msg); | 6162 | file, line, msg); |
| @@ -6264,7 +6166,7 @@ die (msg, file, line) | |||
| 6264 | /* Initialization */ | 6166 | /* Initialization */ |
| 6265 | 6167 | ||
| 6266 | void | 6168 | void |
| 6267 | init_alloc_once () | 6169 | init_alloc_once (void) |
| 6268 | { | 6170 | { |
| 6269 | /* Used to do Vpurify_flag = Qt here, but Qt isn't set up yet! */ | 6171 | /* Used to do Vpurify_flag = Qt here, but Qt isn't set up yet! */ |
| 6270 | purebeg = PUREBEG; | 6172 | purebeg = PUREBEG; |
| @@ -6319,7 +6221,7 @@ init_alloc_once () | |||
| 6319 | } | 6221 | } |
| 6320 | 6222 | ||
| 6321 | void | 6223 | void |
| 6322 | init_alloc () | 6224 | init_alloc (void) |
| 6323 | { | 6225 | { |
| 6324 | gcprolist = 0; | 6226 | gcprolist = 0; |
| 6325 | byte_stack_list = 0; | 6227 | byte_stack_list = 0; |
| @@ -6333,7 +6235,7 @@ init_alloc () | |||
| 6333 | } | 6235 | } |
| 6334 | 6236 | ||
| 6335 | void | 6237 | void |
| 6336 | syms_of_alloc () | 6238 | syms_of_alloc (void) |
| 6337 | { | 6239 | { |
| 6338 | DEFVAR_INT ("gc-cons-threshold", &gc_cons_threshold, | 6240 | DEFVAR_INT ("gc-cons-threshold", &gc_cons_threshold, |
| 6339 | doc: /* *Number of bytes of consing between garbage collections. | 6241 | doc: /* *Number of bytes of consing between garbage collections. |