diff options
| author | Stefan Monnier | 2010-07-23 17:23:09 +0200 |
|---|---|---|
| committer | Stefan Monnier | 2010-07-23 17:23:09 +0200 |
| commit | 0ee81a0ce066375eac701c06cdfbdebefe594fdc (patch) | |
| tree | f0dccd24163316cfe688f927681a3032a9b1fe2f /src/alloc.c | |
| parent | 894e369ddf48e191638b8e66ce732f24ff9abe2a (diff) | |
| parent | 94da839793affa2a270bc26cee9c4d95d4dc4708 (diff) | |
| download | emacs-0ee81a0ce066375eac701c06cdfbdebefe594fdc.tar.gz emacs-0ee81a0ce066375eac701c06cdfbdebefe594fdc.zip | |
Merge from trunk
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 548 |
1 files changed, 213 insertions, 335 deletions
diff --git a/src/alloc.c b/src/alloc.c index a23c688043c..7c8081f03df 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -23,10 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 23 | #include <limits.h> /* For CHAR_BIT. */ | 23 | #include <limits.h> /* For CHAR_BIT. */ |
| 24 | #include <setjmp.h> | 24 | #include <setjmp.h> |
| 25 | 25 | ||
| 26 | #ifdef STDC_HEADERS | ||
| 27 | #include <stddef.h> /* For offsetof, used by PSEUDOVECSIZE. */ | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #ifdef ALLOC_DEBUG | 26 | #ifdef ALLOC_DEBUG |
| 31 | #undef INLINE | 27 | #undef INLINE |
| 32 | #endif | 28 | #endif |
| @@ -298,7 +294,7 @@ static EMACS_INT pure_bytes_used_non_lisp; | |||
| 298 | /* If nonzero, this is a warning delivered by malloc and not yet | 294 | /* If nonzero, this is a warning delivered by malloc and not yet |
| 299 | displayed. */ | 295 | displayed. */ |
| 300 | 296 | ||
| 301 | char *pending_malloc_warning; | 297 | const char *pending_malloc_warning; |
| 302 | 298 | ||
| 303 | /* Pre-computed signal argument for use when memory is exhausted. */ | 299 | /* Pre-computed signal argument for use when memory is exhausted. */ |
| 304 | 300 | ||
| @@ -329,23 +325,23 @@ Lisp_Object Vpost_gc_hook, Qpost_gc_hook; | |||
| 329 | Lisp_Object Vgc_elapsed; /* accumulated elapsed time in GC */ | 325 | Lisp_Object Vgc_elapsed; /* accumulated elapsed time in GC */ |
| 330 | EMACS_INT gcs_done; /* accumulated GCs */ | 326 | EMACS_INT gcs_done; /* accumulated GCs */ |
| 331 | 327 | ||
| 332 | static void mark_buffer P_ ((Lisp_Object)); | 328 | static void mark_buffer (Lisp_Object); |
| 333 | static void mark_terminals P_ ((void)); | 329 | static void mark_terminals (void); |
| 334 | extern void mark_kboards P_ ((void)); | 330 | extern void mark_kboards (void); |
| 335 | extern void mark_ttys P_ ((void)); | 331 | extern void mark_ttys (void); |
| 336 | extern void mark_backtrace P_ ((void)); | 332 | extern void mark_backtrace (void); |
| 337 | static void gc_sweep P_ ((void)); | 333 | static void gc_sweep (void); |
| 338 | static void mark_glyph_matrix P_ ((struct glyph_matrix *)); | 334 | static void mark_glyph_matrix (struct glyph_matrix *); |
| 339 | static void mark_face_cache P_ ((struct face_cache *)); | 335 | static void mark_face_cache (struct face_cache *); |
| 340 | 336 | ||
| 341 | #ifdef HAVE_WINDOW_SYSTEM | 337 | #ifdef HAVE_WINDOW_SYSTEM |
| 342 | extern void mark_fringe_data P_ ((void)); | 338 | extern void mark_fringe_data (void); |
| 343 | #endif /* HAVE_WINDOW_SYSTEM */ | 339 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 344 | 340 | ||
| 345 | static struct Lisp_String *allocate_string P_ ((void)); | 341 | static struct Lisp_String *allocate_string (void); |
| 346 | static void compact_small_strings P_ ((void)); | 342 | static void compact_small_strings (void); |
| 347 | static void free_large_strings P_ ((void)); | 343 | static void free_large_strings (void); |
| 348 | static void sweep_strings P_ ((void)); | 344 | static void sweep_strings (void); |
| 349 | 345 | ||
| 350 | extern int message_enable_multibyte; | 346 | extern int message_enable_multibyte; |
| 351 | 347 | ||
| @@ -369,9 +365,9 @@ enum mem_type | |||
| 369 | MEM_TYPE_VECTORLIKE | 365 | MEM_TYPE_VECTORLIKE |
| 370 | }; | 366 | }; |
| 371 | 367 | ||
| 372 | static POINTER_TYPE *lisp_align_malloc P_ ((size_t, enum mem_type)); | 368 | static POINTER_TYPE *lisp_align_malloc (size_t, enum mem_type); |
| 373 | static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type)); | 369 | static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); |
| 374 | void refill_memory_reserve (); | 370 | void refill_memory_reserve (void); |
| 375 | 371 | ||
| 376 | 372 | ||
| 377 | #if GC_MARK_STACK || defined GC_MALLOC_CHECK | 373 | #if GC_MARK_STACK || defined GC_MALLOC_CHECK |
| @@ -452,31 +448,31 @@ static void *min_heap_address, *max_heap_address; | |||
| 452 | static struct mem_node mem_z; | 448 | static struct mem_node mem_z; |
| 453 | #define MEM_NIL &mem_z | 449 | #define MEM_NIL &mem_z |
| 454 | 450 | ||
| 455 | static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type)); | 451 | static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); |
| 456 | static struct Lisp_Vector *allocate_vectorlike P_ ((EMACS_INT)); | 452 | static struct Lisp_Vector *allocate_vectorlike (EMACS_INT); |
| 457 | static void lisp_free P_ ((POINTER_TYPE *)); | 453 | static void lisp_free (POINTER_TYPE *); |
| 458 | static void mark_stack P_ ((void)); | 454 | static void mark_stack (void); |
| 459 | static int live_vector_p P_ ((struct mem_node *, void *)); | 455 | static int live_vector_p (struct mem_node *, void *); |
| 460 | static int live_buffer_p P_ ((struct mem_node *, void *)); | 456 | static int live_buffer_p (struct mem_node *, void *); |
| 461 | static int live_string_p P_ ((struct mem_node *, void *)); | 457 | static int live_string_p (struct mem_node *, void *); |
| 462 | static int live_cons_p P_ ((struct mem_node *, void *)); | 458 | static int live_cons_p (struct mem_node *, void *); |
| 463 | static int live_symbol_p P_ ((struct mem_node *, void *)); | 459 | static int live_symbol_p (struct mem_node *, void *); |
| 464 | static int live_float_p P_ ((struct mem_node *, void *)); | 460 | static int live_float_p (struct mem_node *, void *); |
| 465 | static int live_misc_p P_ ((struct mem_node *, void *)); | 461 | static int live_misc_p (struct mem_node *, void *); |
| 466 | static void mark_maybe_object P_ ((Lisp_Object)); | 462 | static void mark_maybe_object (Lisp_Object); |
| 467 | static void mark_memory P_ ((void *, void *, int)); | 463 | static void mark_memory (void *, void *, int); |
| 468 | static void mem_init P_ ((void)); | 464 | static void mem_init (void); |
| 469 | static struct mem_node *mem_insert P_ ((void *, void *, enum mem_type)); | 465 | static struct mem_node *mem_insert (void *, void *, enum mem_type); |
| 470 | static void mem_insert_fixup P_ ((struct mem_node *)); | 466 | static void mem_insert_fixup (struct mem_node *); |
| 471 | static void mem_rotate_left P_ ((struct mem_node *)); | 467 | static void mem_rotate_left (struct mem_node *); |
| 472 | static void mem_rotate_right P_ ((struct mem_node *)); | 468 | static void mem_rotate_right (struct mem_node *); |
| 473 | static void mem_delete P_ ((struct mem_node *)); | 469 | static void mem_delete (struct mem_node *); |
| 474 | static void mem_delete_fixup P_ ((struct mem_node *)); | 470 | static void mem_delete_fixup (struct mem_node *); |
| 475 | static INLINE struct mem_node *mem_find P_ ((void *)); | 471 | static INLINE struct mem_node *mem_find (void *); |
| 476 | 472 | ||
| 477 | 473 | ||
| 478 | #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS | 474 | #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS |
| 479 | static void check_gcpros P_ ((void)); | 475 | static void check_gcpros (void); |
| 480 | #endif | 476 | #endif |
| 481 | 477 | ||
| 482 | #endif /* GC_MARK_STACK || GC_MALLOC_CHECK */ | 478 | #endif /* GC_MARK_STACK || GC_MALLOC_CHECK */ |
| @@ -495,7 +491,7 @@ static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag}; | |||
| 495 | 491 | ||
| 496 | static int staticidx = 0; | 492 | static int staticidx = 0; |
| 497 | 493 | ||
| 498 | static POINTER_TYPE *pure_alloc P_ ((size_t, int)); | 494 | static POINTER_TYPE *pure_alloc (size_t, int); |
| 499 | 495 | ||
| 500 | 496 | ||
| 501 | /* Value is SZ rounded up to the next multiple of ALIGNMENT. | 497 | /* Value is SZ rounded up to the next multiple of ALIGNMENT. |
| @@ -514,8 +510,7 @@ static POINTER_TYPE *pure_alloc P_ ((size_t, int)); | |||
| 514 | /* Function malloc calls this if it finds we are near exhausting storage. */ | 510 | /* Function malloc calls this if it finds we are near exhausting storage. */ |
| 515 | 511 | ||
| 516 | void | 512 | void |
| 517 | malloc_warning (str) | 513 | malloc_warning (const char *str) |
| 518 | char *str; | ||
| 519 | { | 514 | { |
| 520 | pending_malloc_warning = str; | 515 | pending_malloc_warning = str; |
| 521 | } | 516 | } |
| @@ -524,7 +519,7 @@ malloc_warning (str) | |||
| 524 | /* Display an already-pending malloc warning. */ | 519 | /* Display an already-pending malloc warning. */ |
| 525 | 520 | ||
| 526 | void | 521 | void |
| 527 | display_malloc_warning () | 522 | display_malloc_warning (void) |
| 528 | { | 523 | { |
| 529 | call3 (intern ("display-warning"), | 524 | call3 (intern ("display-warning"), |
| 530 | intern ("alloc"), | 525 | intern ("alloc"), |
| @@ -543,7 +538,7 @@ display_malloc_warning () | |||
| 543 | /* Called if we can't allocate relocatable space for a buffer. */ | 538 | /* Called if we can't allocate relocatable space for a buffer. */ |
| 544 | 539 | ||
| 545 | void | 540 | void |
| 546 | buffer_memory_full () | 541 | buffer_memory_full (void) |
| 547 | { | 542 | { |
| 548 | /* If buffers use the relocating allocator, no need to free | 543 | /* If buffers use the relocating allocator, no need to free |
| 549 | spare_memory, because we may have plenty of malloc space left | 544 | spare_memory, because we may have plenty of malloc space left |
| @@ -637,10 +632,12 @@ overrun_check_malloc (size) | |||
| 637 | val = (unsigned char *) malloc (size + overhead); | 632 | val = (unsigned char *) malloc (size + overhead); |
| 638 | if (val && check_depth == 1) | 633 | if (val && check_depth == 1) |
| 639 | { | 634 | { |
| 640 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); | 635 | memcpy (val, xmalloc_overrun_check_header, |
| 636 | XMALLOC_OVERRUN_CHECK_SIZE - 4); | ||
| 641 | val += XMALLOC_OVERRUN_CHECK_SIZE; | 637 | val += XMALLOC_OVERRUN_CHECK_SIZE; |
| 642 | XMALLOC_PUT_SIZE(val, size); | 638 | XMALLOC_PUT_SIZE(val, size); |
| 643 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); | 639 | memcpy (val + size, xmalloc_overrun_check_trailer, |
| 640 | XMALLOC_OVERRUN_CHECK_SIZE); | ||
| 644 | } | 641 | } |
| 645 | --check_depth; | 642 | --check_depth; |
| 646 | return (POINTER_TYPE *)val; | 643 | return (POINTER_TYPE *)val; |
| @@ -660,28 +657,29 @@ overrun_check_realloc (block, size) | |||
| 660 | 657 | ||
| 661 | if (val | 658 | if (val |
| 662 | && check_depth == 1 | 659 | && check_depth == 1 |
| 663 | && bcmp (xmalloc_overrun_check_header, | 660 | && memcmp (xmalloc_overrun_check_header, |
| 664 | val - XMALLOC_OVERRUN_CHECK_SIZE, | 661 | val - XMALLOC_OVERRUN_CHECK_SIZE, |
| 665 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) | 662 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) |
| 666 | { | 663 | { |
| 667 | size_t osize = XMALLOC_GET_SIZE (val); | 664 | size_t osize = XMALLOC_GET_SIZE (val); |
| 668 | if (bcmp (xmalloc_overrun_check_trailer, | 665 | if (memcmp (xmalloc_overrun_check_trailer, val + osize, |
| 669 | val + osize, | 666 | XMALLOC_OVERRUN_CHECK_SIZE)) |
| 670 | XMALLOC_OVERRUN_CHECK_SIZE)) | ||
| 671 | abort (); | 667 | abort (); |
| 672 | bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); | 668 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 673 | val -= XMALLOC_OVERRUN_CHECK_SIZE; | 669 | val -= XMALLOC_OVERRUN_CHECK_SIZE; |
| 674 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); | 670 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 675 | } | 671 | } |
| 676 | 672 | ||
| 677 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); | 673 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); |
| 678 | 674 | ||
| 679 | if (val && check_depth == 1) | 675 | if (val && check_depth == 1) |
| 680 | { | 676 | { |
| 681 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); | 677 | memcpy (val, xmalloc_overrun_check_header, |
| 678 | XMALLOC_OVERRUN_CHECK_SIZE - 4); | ||
| 682 | val += XMALLOC_OVERRUN_CHECK_SIZE; | 679 | val += XMALLOC_OVERRUN_CHECK_SIZE; |
| 683 | XMALLOC_PUT_SIZE(val, size); | 680 | XMALLOC_PUT_SIZE(val, size); |
| 684 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); | 681 | memcpy (val + size, xmalloc_overrun_check_trailer, |
| 682 | XMALLOC_OVERRUN_CHECK_SIZE); | ||
| 685 | } | 683 | } |
| 686 | --check_depth; | 684 | --check_depth; |
| 687 | return (POINTER_TYPE *)val; | 685 | return (POINTER_TYPE *)val; |
| @@ -698,22 +696,21 @@ overrun_check_free (block) | |||
| 698 | ++check_depth; | 696 | ++check_depth; |
| 699 | if (val | 697 | if (val |
| 700 | && check_depth == 1 | 698 | && check_depth == 1 |
| 701 | && bcmp (xmalloc_overrun_check_header, | 699 | && memcmp (xmalloc_overrun_check_header, |
| 702 | val - XMALLOC_OVERRUN_CHECK_SIZE, | 700 | val - XMALLOC_OVERRUN_CHECK_SIZE, |
| 703 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) | 701 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) |
| 704 | { | 702 | { |
| 705 | size_t osize = XMALLOC_GET_SIZE (val); | 703 | size_t osize = XMALLOC_GET_SIZE (val); |
| 706 | if (bcmp (xmalloc_overrun_check_trailer, | 704 | if (memcmp (xmalloc_overrun_check_trailer, val + osize, |
| 707 | val + osize, | 705 | XMALLOC_OVERRUN_CHECK_SIZE)) |
| 708 | XMALLOC_OVERRUN_CHECK_SIZE)) | ||
| 709 | abort (); | 706 | abort (); |
| 710 | #ifdef XMALLOC_CLEAR_FREE_MEMORY | 707 | #ifdef XMALLOC_CLEAR_FREE_MEMORY |
| 711 | val -= XMALLOC_OVERRUN_CHECK_SIZE; | 708 | val -= XMALLOC_OVERRUN_CHECK_SIZE; |
| 712 | memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2); | 709 | memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2); |
| 713 | #else | 710 | #else |
| 714 | bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); | 711 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 715 | val -= XMALLOC_OVERRUN_CHECK_SIZE; | 712 | val -= XMALLOC_OVERRUN_CHECK_SIZE; |
| 716 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); | 713 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 717 | #endif | 714 | #endif |
| 718 | } | 715 | } |
| 719 | 716 | ||
| @@ -742,8 +739,7 @@ overrun_check_free (block) | |||
| 742 | /* Like malloc but check for no memory and block interrupt input.. */ | 739 | /* Like malloc but check for no memory and block interrupt input.. */ |
| 743 | 740 | ||
| 744 | POINTER_TYPE * | 741 | POINTER_TYPE * |
| 745 | xmalloc (size) | 742 | xmalloc (size_t size) |
| 746 | size_t size; | ||
| 747 | { | 743 | { |
| 748 | register POINTER_TYPE *val; | 744 | register POINTER_TYPE *val; |
| 749 | 745 | ||
| @@ -760,9 +756,7 @@ xmalloc (size) | |||
| 760 | /* Like realloc but check for no memory and block interrupt input.. */ | 756 | /* Like realloc but check for no memory and block interrupt input.. */ |
| 761 | 757 | ||
| 762 | POINTER_TYPE * | 758 | POINTER_TYPE * |
| 763 | xrealloc (block, size) | 759 | xrealloc (POINTER_TYPE *block, size_t size) |
| 764 | POINTER_TYPE *block; | ||
| 765 | size_t size; | ||
| 766 | { | 760 | { |
| 767 | register POINTER_TYPE *val; | 761 | register POINTER_TYPE *val; |
| 768 | 762 | ||
| @@ -783,8 +777,7 @@ xrealloc (block, size) | |||
| 783 | /* Like free but block interrupt input. */ | 777 | /* Like free but block interrupt input. */ |
| 784 | 778 | ||
| 785 | void | 779 | void |
| 786 | xfree (block) | 780 | xfree (POINTER_TYPE *block) |
| 787 | POINTER_TYPE *block; | ||
| 788 | { | 781 | { |
| 789 | if (!block) | 782 | if (!block) |
| 790 | return; | 783 | return; |
| @@ -800,12 +793,11 @@ xfree (block) | |||
| 800 | /* Like strdup, but uses xmalloc. */ | 793 | /* Like strdup, but uses xmalloc. */ |
| 801 | 794 | ||
| 802 | char * | 795 | char * |
| 803 | xstrdup (s) | 796 | xstrdup (const char *s) |
| 804 | const char *s; | ||
| 805 | { | 797 | { |
| 806 | size_t len = strlen (s) + 1; | 798 | size_t len = strlen (s) + 1; |
| 807 | char *p = (char *) xmalloc (len); | 799 | char *p = (char *) xmalloc (len); |
| 808 | bcopy (s, p, len); | 800 | memcpy (p, s, len); |
| 809 | return p; | 801 | return p; |
| 810 | } | 802 | } |
| 811 | 803 | ||
| @@ -813,8 +805,7 @@ xstrdup (s) | |||
| 813 | /* Unwind for SAFE_ALLOCA */ | 805 | /* Unwind for SAFE_ALLOCA */ |
| 814 | 806 | ||
| 815 | Lisp_Object | 807 | Lisp_Object |
| 816 | safe_alloca_unwind (arg) | 808 | safe_alloca_unwind (Lisp_Object arg) |
| 817 | Lisp_Object arg; | ||
| 818 | { | 809 | { |
| 819 | register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); | 810 | register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); |
| 820 | 811 | ||
| @@ -835,9 +826,7 @@ static void *lisp_malloc_loser; | |||
| 835 | #endif | 826 | #endif |
| 836 | 827 | ||
| 837 | static POINTER_TYPE * | 828 | static POINTER_TYPE * |
| 838 | lisp_malloc (nbytes, type) | 829 | lisp_malloc (size_t nbytes, enum mem_type type) |
| 839 | size_t nbytes; | ||
| 840 | enum mem_type type; | ||
| 841 | { | 830 | { |
| 842 | register void *val; | 831 | register void *val; |
| 843 | 832 | ||
| @@ -881,8 +870,7 @@ lisp_malloc (nbytes, type) | |||
| 881 | call to lisp_malloc. */ | 870 | call to lisp_malloc. */ |
| 882 | 871 | ||
| 883 | static void | 872 | static void |
| 884 | lisp_free (block) | 873 | lisp_free (POINTER_TYPE *block) |
| 885 | POINTER_TYPE *block; | ||
| 886 | { | 874 | { |
| 887 | MALLOC_BLOCK_INPUT; | 875 | MALLOC_BLOCK_INPUT; |
| 888 | free (block); | 876 | free (block); |
| @@ -981,9 +969,7 @@ static struct ablock *free_ablock; | |||
| 981 | Alignment is on a multiple of BLOCK_ALIGN and `nbytes' has to be | 969 | Alignment is on a multiple of BLOCK_ALIGN and `nbytes' has to be |
| 982 | smaller or equal to BLOCK_BYTES. */ | 970 | smaller or equal to BLOCK_BYTES. */ |
| 983 | static POINTER_TYPE * | 971 | static POINTER_TYPE * |
| 984 | lisp_align_malloc (nbytes, type) | 972 | lisp_align_malloc (size_t nbytes, enum mem_type type) |
| 985 | size_t nbytes; | ||
| 986 | enum mem_type type; | ||
| 987 | { | 973 | { |
| 988 | void *base, *val; | 974 | void *base, *val; |
| 989 | struct ablocks *abase; | 975 | struct ablocks *abase; |
| @@ -1090,8 +1076,7 @@ lisp_align_malloc (nbytes, type) | |||
| 1090 | } | 1076 | } |
| 1091 | 1077 | ||
| 1092 | static void | 1078 | static void |
| 1093 | lisp_align_free (block) | 1079 | lisp_align_free (POINTER_TYPE *block) |
| 1094 | POINTER_TYPE *block; | ||
| 1095 | { | 1080 | { |
| 1096 | struct ablock *ablock = block; | 1081 | struct ablock *ablock = block; |
| 1097 | struct ablocks *abase = ABLOCK_ABASE (ablock); | 1082 | struct ablocks *abase = ABLOCK_ABASE (ablock); |
| @@ -1136,7 +1121,7 @@ lisp_align_free (block) | |||
| 1136 | a call to lisp_malloc. */ | 1121 | a call to lisp_malloc. */ |
| 1137 | 1122 | ||
| 1138 | struct buffer * | 1123 | struct buffer * |
| 1139 | allocate_buffer () | 1124 | allocate_buffer (void) |
| 1140 | { | 1125 | { |
| 1141 | struct buffer *b | 1126 | struct buffer *b |
| 1142 | = (struct buffer *) lisp_malloc (sizeof (struct buffer), | 1127 | = (struct buffer *) lisp_malloc (sizeof (struct buffer), |
| @@ -1164,21 +1149,19 @@ allocate_buffer () | |||
| 1164 | there's no need to block input around malloc. */ | 1149 | there's no need to block input around malloc. */ |
| 1165 | 1150 | ||
| 1166 | #ifndef DOUG_LEA_MALLOC | 1151 | #ifndef DOUG_LEA_MALLOC |
| 1167 | extern void * (*__malloc_hook) P_ ((size_t, const void *)); | 1152 | extern void * (*__malloc_hook) (size_t, const void *); |
| 1168 | extern void * (*__realloc_hook) P_ ((void *, size_t, const void *)); | 1153 | extern void * (*__realloc_hook) (void *, size_t, const void *); |
| 1169 | extern void (*__free_hook) P_ ((void *, const void *)); | 1154 | extern void (*__free_hook) (void *, const void *); |
| 1170 | /* Else declared in malloc.h, perhaps with an extra arg. */ | 1155 | /* Else declared in malloc.h, perhaps with an extra arg. */ |
| 1171 | #endif /* DOUG_LEA_MALLOC */ | 1156 | #endif /* DOUG_LEA_MALLOC */ |
| 1172 | static void * (*old_malloc_hook) P_ ((size_t, const void *)); | 1157 | static void * (*old_malloc_hook) (size_t, const void *); |
| 1173 | static void * (*old_realloc_hook) P_ ((void *, size_t, const void*)); | 1158 | static void * (*old_realloc_hook) (void *, size_t, const void*); |
| 1174 | static void (*old_free_hook) P_ ((void*, const void*)); | 1159 | static void (*old_free_hook) (void*, const void*); |
| 1175 | 1160 | ||
| 1176 | /* This function is used as the hook for free to call. */ | 1161 | /* This function is used as the hook for free to call. */ |
| 1177 | 1162 | ||
| 1178 | static void | 1163 | static void |
| 1179 | emacs_blocked_free (ptr, ptr2) | 1164 | emacs_blocked_free (void *ptr, const void *ptr2) |
| 1180 | void *ptr; | ||
| 1181 | const void *ptr2; | ||
| 1182 | { | 1165 | { |
| 1183 | BLOCK_INPUT_ALLOC; | 1166 | BLOCK_INPUT_ALLOC; |
| 1184 | 1167 | ||
| @@ -1226,9 +1209,7 @@ emacs_blocked_free (ptr, ptr2) | |||
| 1226 | /* This function is the malloc hook that Emacs uses. */ | 1209 | /* This function is the malloc hook that Emacs uses. */ |
| 1227 | 1210 | ||
| 1228 | static void * | 1211 | static void * |
| 1229 | emacs_blocked_malloc (size, ptr) | 1212 | emacs_blocked_malloc (size_t size, const void *ptr) |
| 1230 | size_t size; | ||
| 1231 | const void *ptr; | ||
| 1232 | { | 1213 | { |
| 1233 | void *value; | 1214 | void *value; |
| 1234 | 1215 | ||
| @@ -1275,10 +1256,7 @@ emacs_blocked_malloc (size, ptr) | |||
| 1275 | /* This function is the realloc hook that Emacs uses. */ | 1256 | /* This function is the realloc hook that Emacs uses. */ |
| 1276 | 1257 | ||
| 1277 | static void * | 1258 | static void * |
| 1278 | emacs_blocked_realloc (ptr, size, ptr2) | 1259 | emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2) |
| 1279 | void *ptr; | ||
| 1280 | size_t size; | ||
| 1281 | const void *ptr2; | ||
| 1282 | { | 1260 | { |
| 1283 | void *value; | 1261 | void *value; |
| 1284 | 1262 | ||
| @@ -1352,7 +1330,7 @@ reset_malloc_hooks () | |||
| 1352 | /* Called from main to set up malloc to use our hooks. */ | 1330 | /* Called from main to set up malloc to use our hooks. */ |
| 1353 | 1331 | ||
| 1354 | void | 1332 | void |
| 1355 | uninterrupt_malloc () | 1333 | uninterrupt_malloc (void) |
| 1356 | { | 1334 | { |
| 1357 | #ifdef HAVE_GTK_AND_PTHREAD | 1335 | #ifdef HAVE_GTK_AND_PTHREAD |
| 1358 | #ifdef DOUG_LEA_MALLOC | 1336 | #ifdef DOUG_LEA_MALLOC |
| @@ -1434,7 +1412,7 @@ static int n_interval_blocks; | |||
| 1434 | /* Initialize interval allocation. */ | 1412 | /* Initialize interval allocation. */ |
| 1435 | 1413 | ||
| 1436 | static void | 1414 | static void |
| 1437 | init_intervals () | 1415 | init_intervals (void) |
| 1438 | { | 1416 | { |
| 1439 | interval_block = NULL; | 1417 | interval_block = NULL; |
| 1440 | interval_block_index = INTERVAL_BLOCK_SIZE; | 1418 | interval_block_index = INTERVAL_BLOCK_SIZE; |
| @@ -1446,7 +1424,7 @@ init_intervals () | |||
| 1446 | /* Return a new interval. */ | 1424 | /* Return a new interval. */ |
| 1447 | 1425 | ||
| 1448 | INTERVAL | 1426 | INTERVAL |
| 1449 | make_interval () | 1427 | make_interval (void) |
| 1450 | { | 1428 | { |
| 1451 | INTERVAL val; | 1429 | INTERVAL val; |
| 1452 | 1430 | ||
| @@ -1489,9 +1467,7 @@ make_interval () | |||
| 1489 | /* Mark Lisp objects in interval I. */ | 1467 | /* Mark Lisp objects in interval I. */ |
| 1490 | 1468 | ||
| 1491 | static void | 1469 | static void |
| 1492 | mark_interval (i, dummy) | 1470 | mark_interval (register INTERVAL i, Lisp_Object dummy) |
| 1493 | register INTERVAL i; | ||
| 1494 | Lisp_Object dummy; | ||
| 1495 | { | 1471 | { |
| 1496 | eassert (!i->gcmarkbit); /* Intervals are never shared. */ | 1472 | eassert (!i->gcmarkbit); /* Intervals are never shared. */ |
| 1497 | i->gcmarkbit = 1; | 1473 | i->gcmarkbit = 1; |
| @@ -1503,8 +1479,7 @@ mark_interval (i, dummy) | |||
| 1503 | use the macro MARK_INTERVAL_TREE instead. */ | 1479 | use the macro MARK_INTERVAL_TREE instead. */ |
| 1504 | 1480 | ||
| 1505 | static void | 1481 | static void |
| 1506 | mark_interval_tree (tree) | 1482 | mark_interval_tree (register INTERVAL tree) |
| 1507 | register INTERVAL tree; | ||
| 1508 | { | 1483 | { |
| 1509 | /* No need to test if this tree has been marked already; this | 1484 | /* No need to test if this tree has been marked already; this |
| 1510 | function is always called through the MARK_INTERVAL_TREE macro, | 1485 | function is always called through the MARK_INTERVAL_TREE macro, |
| @@ -1751,7 +1726,7 @@ static char string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = | |||
| 1751 | /* Initialize string allocation. Called from init_alloc_once. */ | 1726 | /* Initialize string allocation. Called from init_alloc_once. */ |
| 1752 | 1727 | ||
| 1753 | static void | 1728 | static void |
| 1754 | init_strings () | 1729 | init_strings (void) |
| 1755 | { | 1730 | { |
| 1756 | total_strings = total_free_strings = total_string_size = 0; | 1731 | total_strings = total_free_strings = total_string_size = 0; |
| 1757 | oldest_sblock = current_sblock = large_sblocks = NULL; | 1732 | oldest_sblock = current_sblock = large_sblocks = NULL; |
| @@ -1767,8 +1742,8 @@ init_strings () | |||
| 1767 | 1742 | ||
| 1768 | static int check_string_bytes_count; | 1743 | static int check_string_bytes_count; |
| 1769 | 1744 | ||
| 1770 | static void check_string_bytes P_ ((int)); | 1745 | static void check_string_bytes (int); |
| 1771 | static void check_sblock P_ ((struct sblock *)); | 1746 | static void check_sblock (struct sblock *); |
| 1772 | 1747 | ||
| 1773 | #define CHECK_STRING_BYTES(S) STRING_BYTES (S) | 1748 | #define CHECK_STRING_BYTES(S) STRING_BYTES (S) |
| 1774 | 1749 | ||
| @@ -1873,7 +1848,7 @@ check_string_free_list () | |||
| 1873 | /* Return a new Lisp_String. */ | 1848 | /* Return a new Lisp_String. */ |
| 1874 | 1849 | ||
| 1875 | static struct Lisp_String * | 1850 | static struct Lisp_String * |
| 1876 | allocate_string () | 1851 | allocate_string (void) |
| 1877 | { | 1852 | { |
| 1878 | struct Lisp_String *s; | 1853 | struct Lisp_String *s; |
| 1879 | 1854 | ||
| @@ -1889,7 +1864,7 @@ allocate_string () | |||
| 1889 | int i; | 1864 | int i; |
| 1890 | 1865 | ||
| 1891 | b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING); | 1866 | b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING); |
| 1892 | bzero (b, sizeof *b); | 1867 | memset (b, 0, sizeof *b); |
| 1893 | b->next = string_blocks; | 1868 | b->next = string_blocks; |
| 1894 | string_blocks = b; | 1869 | string_blocks = b; |
| 1895 | ++n_string_blocks; | 1870 | ++n_string_blocks; |
| @@ -1913,7 +1888,7 @@ allocate_string () | |||
| 1913 | MALLOC_UNBLOCK_INPUT; | 1888 | MALLOC_UNBLOCK_INPUT; |
| 1914 | 1889 | ||
| 1915 | /* Probably not strictly necessary, but play it safe. */ | 1890 | /* Probably not strictly necessary, but play it safe. */ |
| 1916 | bzero (s, sizeof *s); | 1891 | memset (s, 0, sizeof *s); |
| 1917 | 1892 | ||
| 1918 | --total_free_strings; | 1893 | --total_free_strings; |
| 1919 | ++total_strings; | 1894 | ++total_strings; |
| @@ -1944,9 +1919,7 @@ allocate_string () | |||
| 1944 | S->data if it was initially non-null. */ | 1919 | S->data if it was initially non-null. */ |
| 1945 | 1920 | ||
| 1946 | void | 1921 | void |
| 1947 | allocate_string_data (s, nchars, nbytes) | 1922 | allocate_string_data (struct Lisp_String *s, int nchars, int nbytes) |
| 1948 | struct Lisp_String *s; | ||
| 1949 | int nchars, nbytes; | ||
| 1950 | { | 1923 | { |
| 1951 | struct sdata *data, *old_data; | 1924 | struct sdata *data, *old_data; |
| 1952 | struct sblock *b; | 1925 | struct sblock *b; |
| @@ -2023,8 +1996,7 @@ allocate_string_data (s, nchars, nbytes) | |||
| 2023 | s->size_byte = nbytes; | 1996 | s->size_byte = nbytes; |
| 2024 | s->data[nbytes] = '\0'; | 1997 | s->data[nbytes] = '\0'; |
| 2025 | #ifdef GC_CHECK_STRING_OVERRUN | 1998 | #ifdef GC_CHECK_STRING_OVERRUN |
| 2026 | bcopy (string_overrun_cookie, (char *) data + needed, | 1999 | memcpy (data + needed, string_overrun_cookie, GC_STRING_OVERRUN_COOKIE_SIZE); |
| 2027 | GC_STRING_OVERRUN_COOKIE_SIZE); | ||
| 2028 | #endif | 2000 | #endif |
| 2029 | 2001 | ||
| 2030 | /* If S had already data assigned, mark that as free by setting its | 2002 | /* If S had already data assigned, mark that as free by setting its |
| @@ -2043,7 +2015,7 @@ allocate_string_data (s, nchars, nbytes) | |||
| 2043 | /* Sweep and compact strings. */ | 2015 | /* Sweep and compact strings. */ |
| 2044 | 2016 | ||
| 2045 | static void | 2017 | static void |
| 2046 | sweep_strings () | 2018 | sweep_strings (void) |
| 2047 | { | 2019 | { |
| 2048 | struct string_block *b, *next; | 2020 | struct string_block *b, *next; |
| 2049 | struct string_block *live_blocks = NULL; | 2021 | struct string_block *live_blocks = NULL; |
| @@ -2143,7 +2115,7 @@ sweep_strings () | |||
| 2143 | /* Free dead large strings. */ | 2115 | /* Free dead large strings. */ |
| 2144 | 2116 | ||
| 2145 | static void | 2117 | static void |
| 2146 | free_large_strings () | 2118 | free_large_strings (void) |
| 2147 | { | 2119 | { |
| 2148 | struct sblock *b, *next; | 2120 | struct sblock *b, *next; |
| 2149 | struct sblock *live_blocks = NULL; | 2121 | struct sblock *live_blocks = NULL; |
| @@ -2169,7 +2141,7 @@ free_large_strings () | |||
| 2169 | data of live strings after compaction. */ | 2141 | data of live strings after compaction. */ |
| 2170 | 2142 | ||
| 2171 | static void | 2143 | static void |
| 2172 | compact_small_strings () | 2144 | compact_small_strings (void) |
| 2173 | { | 2145 | { |
| 2174 | struct sblock *b, *tb, *next; | 2146 | struct sblock *b, *tb, *next; |
| 2175 | struct sdata *from, *to, *end, *tb_end; | 2147 | struct sdata *from, *to, *end, *tb_end; |
| @@ -2215,9 +2187,9 @@ compact_small_strings () | |||
| 2215 | from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); | 2187 | from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); |
| 2216 | 2188 | ||
| 2217 | #ifdef GC_CHECK_STRING_OVERRUN | 2189 | #ifdef GC_CHECK_STRING_OVERRUN |
| 2218 | if (bcmp (string_overrun_cookie, | 2190 | if (memcmp (string_overrun_cookie, |
| 2219 | ((char *) from_end) - GC_STRING_OVERRUN_COOKIE_SIZE, | 2191 | (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE, |
| 2220 | GC_STRING_OVERRUN_COOKIE_SIZE)) | 2192 | GC_STRING_OVERRUN_COOKIE_SIZE)) |
| 2221 | abort (); | 2193 | abort (); |
| 2222 | #endif | 2194 | #endif |
| 2223 | 2195 | ||
| @@ -2239,7 +2211,7 @@ compact_small_strings () | |||
| 2239 | if (from != to) | 2211 | if (from != to) |
| 2240 | { | 2212 | { |
| 2241 | xassert (tb != b || to <= from); | 2213 | xassert (tb != b || to <= from); |
| 2242 | safe_bcopy ((char *) from, (char *) to, nbytes + GC_STRING_EXTRA); | 2214 | memmove (to, from, nbytes + GC_STRING_EXTRA); |
| 2243 | to->string->data = SDATA_DATA (to); | 2215 | to->string->data = SDATA_DATA (to); |
| 2244 | } | 2216 | } |
| 2245 | 2217 | ||
| @@ -2267,8 +2239,7 @@ DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0, | |||
| 2267 | doc: /* Return a newly created string of length LENGTH, with INIT in each element. | 2239 | doc: /* Return a newly created string of length LENGTH, with INIT in each element. |
| 2268 | LENGTH must be an integer. | 2240 | LENGTH must be an integer. |
| 2269 | INIT must be an integer that represents a character. */) | 2241 | INIT must be an integer that represents a character. */) |
| 2270 | (length, init) | 2242 | (Lisp_Object length, Lisp_Object init) |
| 2271 | Lisp_Object length, init; | ||
| 2272 | { | 2243 | { |
| 2273 | register Lisp_Object val; | 2244 | register Lisp_Object val; |
| 2274 | register unsigned char *p, *end; | 2245 | register unsigned char *p, *end; |
| @@ -2298,7 +2269,7 @@ INIT must be an integer that represents a character. */) | |||
| 2298 | end = p + nbytes; | 2269 | end = p + nbytes; |
| 2299 | while (p != end) | 2270 | while (p != end) |
| 2300 | { | 2271 | { |
| 2301 | bcopy (str, p, len); | 2272 | memcpy (p, str, len); |
| 2302 | p += len; | 2273 | p += len; |
| 2303 | } | 2274 | } |
| 2304 | } | 2275 | } |
| @@ -2311,8 +2282,7 @@ INIT must be an integer that represents a character. */) | |||
| 2311 | DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0, | 2282 | DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0, |
| 2312 | doc: /* Return a new bool-vector of length LENGTH, using INIT for each element. | 2283 | doc: /* Return a new bool-vector of length LENGTH, using INIT for each element. |
| 2313 | LENGTH must be a number. INIT matters only in whether it is t or nil. */) | 2284 | LENGTH must be a number. INIT matters only in whether it is t or nil. */) |
| 2314 | (length, init) | 2285 | (Lisp_Object length, Lisp_Object init) |
| 2315 | Lisp_Object length, init; | ||
| 2316 | { | 2286 | { |
| 2317 | register Lisp_Object val; | 2287 | register Lisp_Object val; |
| 2318 | struct Lisp_Bool_Vector *p; | 2288 | struct Lisp_Bool_Vector *p; |
| @@ -2357,9 +2327,7 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 2357 | multibyte, depending on the contents. */ | 2327 | multibyte, depending on the contents. */ |
| 2358 | 2328 | ||
| 2359 | Lisp_Object | 2329 | Lisp_Object |
| 2360 | make_string (contents, nbytes) | 2330 | make_string (const char *contents, int nbytes) |
| 2361 | const char *contents; | ||
| 2362 | int nbytes; | ||
| 2363 | { | 2331 | { |
| 2364 | register Lisp_Object val; | 2332 | register Lisp_Object val; |
| 2365 | int nchars, multibyte_nbytes; | 2333 | int nchars, multibyte_nbytes; |
| @@ -2378,13 +2346,11 @@ make_string (contents, nbytes) | |||
| 2378 | /* Make an unibyte string from LENGTH bytes at CONTENTS. */ | 2346 | /* Make an unibyte string from LENGTH bytes at CONTENTS. */ |
| 2379 | 2347 | ||
| 2380 | Lisp_Object | 2348 | Lisp_Object |
| 2381 | make_unibyte_string (contents, length) | 2349 | make_unibyte_string (const char *contents, int length) |
| 2382 | const char *contents; | ||
| 2383 | int length; | ||
| 2384 | { | 2350 | { |
| 2385 | register Lisp_Object val; | 2351 | register Lisp_Object val; |
| 2386 | val = make_uninit_string (length); | 2352 | val = make_uninit_string (length); |
| 2387 | bcopy (contents, SDATA (val), length); | 2353 | memcpy (SDATA (val), contents, length); |
| 2388 | STRING_SET_UNIBYTE (val); | 2354 | STRING_SET_UNIBYTE (val); |
| 2389 | return val; | 2355 | return val; |
| 2390 | } | 2356 | } |
| @@ -2394,13 +2360,11 @@ make_unibyte_string (contents, length) | |||
| 2394 | bytes at CONTENTS. */ | 2360 | bytes at CONTENTS. */ |
| 2395 | 2361 | ||
| 2396 | Lisp_Object | 2362 | Lisp_Object |
| 2397 | make_multibyte_string (contents, nchars, nbytes) | 2363 | make_multibyte_string (const char *contents, int nchars, int nbytes) |
| 2398 | const char *contents; | ||
| 2399 | int nchars, nbytes; | ||
| 2400 | { | 2364 | { |
| 2401 | register Lisp_Object val; | 2365 | register Lisp_Object val; |
| 2402 | val = make_uninit_multibyte_string (nchars, nbytes); | 2366 | val = make_uninit_multibyte_string (nchars, nbytes); |
| 2403 | bcopy (contents, SDATA (val), nbytes); | 2367 | memcpy (SDATA (val), contents, nbytes); |
| 2404 | return val; | 2368 | return val; |
| 2405 | } | 2369 | } |
| 2406 | 2370 | ||
| @@ -2409,13 +2373,11 @@ make_multibyte_string (contents, nchars, nbytes) | |||
| 2409 | CONTENTS. It is a multibyte string if NBYTES != NCHARS. */ | 2373 | CONTENTS. It is a multibyte string if NBYTES != NCHARS. */ |
| 2410 | 2374 | ||
| 2411 | Lisp_Object | 2375 | Lisp_Object |
| 2412 | make_string_from_bytes (contents, nchars, nbytes) | 2376 | make_string_from_bytes (const char *contents, int nchars, int nbytes) |
| 2413 | const char *contents; | ||
| 2414 | int nchars, nbytes; | ||
| 2415 | { | 2377 | { |
| 2416 | register Lisp_Object val; | 2378 | register Lisp_Object val; |
| 2417 | val = make_uninit_multibyte_string (nchars, nbytes); | 2379 | val = make_uninit_multibyte_string (nchars, nbytes); |
| 2418 | bcopy (contents, SDATA (val), nbytes); | 2380 | memcpy (SDATA (val), contents, nbytes); |
| 2419 | if (SBYTES (val) == SCHARS (val)) | 2381 | if (SBYTES (val) == SCHARS (val)) |
| 2420 | STRING_SET_UNIBYTE (val); | 2382 | STRING_SET_UNIBYTE (val); |
| 2421 | return val; | 2383 | return val; |
| @@ -2428,10 +2390,7 @@ make_string_from_bytes (contents, nchars, nbytes) | |||
| 2428 | characters by itself. */ | 2390 | characters by itself. */ |
| 2429 | 2391 | ||
| 2430 | Lisp_Object | 2392 | Lisp_Object |
| 2431 | make_specified_string (contents, nchars, nbytes, multibyte) | 2393 | make_specified_string (const char *contents, int nchars, int nbytes, int multibyte) |
| 2432 | const char *contents; | ||
| 2433 | int nchars, nbytes; | ||
| 2434 | int multibyte; | ||
| 2435 | { | 2394 | { |
| 2436 | register Lisp_Object val; | 2395 | register Lisp_Object val; |
| 2437 | 2396 | ||
| @@ -2443,7 +2402,7 @@ make_specified_string (contents, nchars, nbytes, multibyte) | |||
| 2443 | nchars = nbytes; | 2402 | nchars = nbytes; |
| 2444 | } | 2403 | } |
| 2445 | val = make_uninit_multibyte_string (nchars, nbytes); | 2404 | val = make_uninit_multibyte_string (nchars, nbytes); |
| 2446 | bcopy (contents, SDATA (val), nbytes); | 2405 | memcpy (SDATA (val), contents, nbytes); |
| 2447 | if (!multibyte) | 2406 | if (!multibyte) |
| 2448 | STRING_SET_UNIBYTE (val); | 2407 | STRING_SET_UNIBYTE (val); |
| 2449 | return val; | 2408 | return val; |
| @@ -2454,8 +2413,7 @@ make_specified_string (contents, nchars, nbytes, multibyte) | |||
| 2454 | data warrants. */ | 2413 | data warrants. */ |
| 2455 | 2414 | ||
| 2456 | Lisp_Object | 2415 | Lisp_Object |
| 2457 | build_string (str) | 2416 | build_string (const char *str) |
| 2458 | const char *str; | ||
| 2459 | { | 2417 | { |
| 2460 | return make_string (str, strlen (str)); | 2418 | return make_string (str, strlen (str)); |
| 2461 | } | 2419 | } |
| @@ -2465,8 +2423,7 @@ build_string (str) | |||
| 2465 | occupying LENGTH bytes. */ | 2423 | occupying LENGTH bytes. */ |
| 2466 | 2424 | ||
| 2467 | Lisp_Object | 2425 | Lisp_Object |
| 2468 | make_uninit_string (length) | 2426 | make_uninit_string (int length) |
| 2469 | int length; | ||
| 2470 | { | 2427 | { |
| 2471 | Lisp_Object val; | 2428 | Lisp_Object val; |
| 2472 | 2429 | ||
| @@ -2482,8 +2439,7 @@ make_uninit_string (length) | |||
| 2482 | which occupy NBYTES bytes. */ | 2439 | which occupy NBYTES bytes. */ |
| 2483 | 2440 | ||
| 2484 | Lisp_Object | 2441 | Lisp_Object |
| 2485 | make_uninit_multibyte_string (nchars, nbytes) | 2442 | make_uninit_multibyte_string (int nchars, int nbytes) |
| 2486 | int nchars, nbytes; | ||
| 2487 | { | 2443 | { |
| 2488 | Lisp_Object string; | 2444 | Lisp_Object string; |
| 2489 | struct Lisp_String *s; | 2445 | struct Lisp_String *s; |
| @@ -2573,7 +2529,7 @@ struct Lisp_Float *float_free_list; | |||
| 2573 | /* Initialize float allocation. */ | 2529 | /* Initialize float allocation. */ |
| 2574 | 2530 | ||
| 2575 | static void | 2531 | static void |
| 2576 | init_float () | 2532 | init_float (void) |
| 2577 | { | 2533 | { |
| 2578 | float_block = NULL; | 2534 | float_block = NULL; |
| 2579 | float_block_index = FLOAT_BLOCK_SIZE; /* Force alloc of new float_block. */ | 2535 | float_block_index = FLOAT_BLOCK_SIZE; /* Force alloc of new float_block. */ |
| @@ -2585,8 +2541,7 @@ init_float () | |||
| 2585 | /* Explicitly free a float cell by putting it on the free-list. */ | 2541 | /* Explicitly free a float cell by putting it on the free-list. */ |
| 2586 | 2542 | ||
| 2587 | static void | 2543 | static void |
| 2588 | free_float (ptr) | 2544 | free_float (struct Lisp_Float *ptr) |
| 2589 | struct Lisp_Float *ptr; | ||
| 2590 | { | 2545 | { |
| 2591 | ptr->u.chain = float_free_list; | 2546 | ptr->u.chain = float_free_list; |
| 2592 | float_free_list = ptr; | 2547 | float_free_list = ptr; |
| @@ -2596,8 +2551,7 @@ free_float (ptr) | |||
| 2596 | /* Return a new float object with value FLOAT_VALUE. */ | 2551 | /* Return a new float object with value FLOAT_VALUE. */ |
| 2597 | 2552 | ||
| 2598 | Lisp_Object | 2553 | Lisp_Object |
| 2599 | make_float (float_value) | 2554 | make_float (double float_value) |
| 2600 | double float_value; | ||
| 2601 | { | 2555 | { |
| 2602 | register Lisp_Object val; | 2556 | register Lisp_Object val; |
| 2603 | 2557 | ||
| @@ -2621,7 +2575,7 @@ make_float (float_value) | |||
| 2621 | new = (struct float_block *) lisp_align_malloc (sizeof *new, | 2575 | new = (struct float_block *) lisp_align_malloc (sizeof *new, |
| 2622 | MEM_TYPE_FLOAT); | 2576 | MEM_TYPE_FLOAT); |
| 2623 | new->next = float_block; | 2577 | new->next = float_block; |
| 2624 | bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); | 2578 | memset (new->gcmarkbits, 0, sizeof new->gcmarkbits); |
| 2625 | float_block = new; | 2579 | float_block = new; |
| 2626 | float_block_index = 0; | 2580 | float_block_index = 0; |
| 2627 | n_float_blocks++; | 2581 | n_float_blocks++; |
| @@ -2697,7 +2651,7 @@ static int n_cons_blocks; | |||
| 2697 | /* Initialize cons allocation. */ | 2651 | /* Initialize cons allocation. */ |
| 2698 | 2652 | ||
| 2699 | static void | 2653 | static void |
| 2700 | init_cons () | 2654 | init_cons (void) |
| 2701 | { | 2655 | { |
| 2702 | cons_block = NULL; | 2656 | cons_block = NULL; |
| 2703 | cons_block_index = CONS_BLOCK_SIZE; /* Force alloc of new cons_block. */ | 2657 | cons_block_index = CONS_BLOCK_SIZE; /* Force alloc of new cons_block. */ |
| @@ -2709,8 +2663,7 @@ init_cons () | |||
| 2709 | /* Explicitly free a cons cell by putting it on the free-list. */ | 2663 | /* Explicitly free a cons cell by putting it on the free-list. */ |
| 2710 | 2664 | ||
| 2711 | void | 2665 | void |
| 2712 | free_cons (ptr) | 2666 | free_cons (struct Lisp_Cons *ptr) |
| 2713 | struct Lisp_Cons *ptr; | ||
| 2714 | { | 2667 | { |
| 2715 | ptr->u.chain = cons_free_list; | 2668 | ptr->u.chain = cons_free_list; |
| 2716 | #if GC_MARK_STACK | 2669 | #if GC_MARK_STACK |
| @@ -2721,8 +2674,7 @@ free_cons (ptr) | |||
| 2721 | 2674 | ||
| 2722 | DEFUN ("cons", Fcons, Scons, 2, 2, 0, | 2675 | DEFUN ("cons", Fcons, Scons, 2, 2, 0, |
| 2723 | doc: /* Create a new cons, give it CAR and CDR as components, and return it. */) | 2676 | doc: /* Create a new cons, give it CAR and CDR as components, and return it. */) |
| 2724 | (car, cdr) | 2677 | (Lisp_Object car, Lisp_Object cdr) |
| 2725 | Lisp_Object car, cdr; | ||
| 2726 | { | 2678 | { |
| 2727 | register Lisp_Object val; | 2679 | register Lisp_Object val; |
| 2728 | 2680 | ||
| @@ -2744,7 +2696,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 2744 | register struct cons_block *new; | 2696 | register struct cons_block *new; |
| 2745 | new = (struct cons_block *) lisp_align_malloc (sizeof *new, | 2697 | new = (struct cons_block *) lisp_align_malloc (sizeof *new, |
| 2746 | MEM_TYPE_CONS); | 2698 | MEM_TYPE_CONS); |
| 2747 | bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); | 2699 | memset (new->gcmarkbits, 0, sizeof new->gcmarkbits); |
| 2748 | new->next = cons_block; | 2700 | new->next = cons_block; |
| 2749 | cons_block = new; | 2701 | cons_block = new; |
| 2750 | cons_block_index = 0; | 2702 | cons_block_index = 0; |
| @@ -2766,7 +2718,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 2766 | 2718 | ||
| 2767 | /* Get an error now if there's any junk in the cons free list. */ | 2719 | /* Get an error now if there's any junk in the cons free list. */ |
| 2768 | void | 2720 | void |
| 2769 | check_cons_list () | 2721 | check_cons_list (void) |
| 2770 | { | 2722 | { |
| 2771 | #ifdef GC_CHECK_CONS_LIST | 2723 | #ifdef GC_CHECK_CONS_LIST |
| 2772 | struct Lisp_Cons *tail = cons_free_list; | 2724 | struct Lisp_Cons *tail = cons_free_list; |
| @@ -2779,39 +2731,34 @@ check_cons_list () | |||
| 2779 | /* Make a list of 1, 2, 3, 4 or 5 specified objects. */ | 2731 | /* Make a list of 1, 2, 3, 4 or 5 specified objects. */ |
| 2780 | 2732 | ||
| 2781 | Lisp_Object | 2733 | Lisp_Object |
| 2782 | list1 (arg1) | 2734 | list1 (Lisp_Object arg1) |
| 2783 | Lisp_Object arg1; | ||
| 2784 | { | 2735 | { |
| 2785 | return Fcons (arg1, Qnil); | 2736 | return Fcons (arg1, Qnil); |
| 2786 | } | 2737 | } |
| 2787 | 2738 | ||
| 2788 | Lisp_Object | 2739 | Lisp_Object |
| 2789 | list2 (arg1, arg2) | 2740 | list2 (Lisp_Object arg1, Lisp_Object arg2) |
| 2790 | Lisp_Object arg1, arg2; | ||
| 2791 | { | 2741 | { |
| 2792 | return Fcons (arg1, Fcons (arg2, Qnil)); | 2742 | return Fcons (arg1, Fcons (arg2, Qnil)); |
| 2793 | } | 2743 | } |
| 2794 | 2744 | ||
| 2795 | 2745 | ||
| 2796 | Lisp_Object | 2746 | Lisp_Object |
| 2797 | list3 (arg1, arg2, arg3) | 2747 | list3 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) |
| 2798 | Lisp_Object arg1, arg2, arg3; | ||
| 2799 | { | 2748 | { |
| 2800 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Qnil))); | 2749 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Qnil))); |
| 2801 | } | 2750 | } |
| 2802 | 2751 | ||
| 2803 | 2752 | ||
| 2804 | Lisp_Object | 2753 | Lisp_Object |
| 2805 | list4 (arg1, arg2, arg3, arg4) | 2754 | list4 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4) |
| 2806 | Lisp_Object arg1, arg2, arg3, arg4; | ||
| 2807 | { | 2755 | { |
| 2808 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Qnil)))); | 2756 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Qnil)))); |
| 2809 | } | 2757 | } |
| 2810 | 2758 | ||
| 2811 | 2759 | ||
| 2812 | Lisp_Object | 2760 | Lisp_Object |
| 2813 | list5 (arg1, arg2, arg3, arg4, arg5) | 2761 | 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 | { | 2762 | { |
| 2816 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, | 2763 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, |
| 2817 | Fcons (arg5, Qnil))))); | 2764 | Fcons (arg5, Qnil))))); |
| @@ -2822,9 +2769,7 @@ DEFUN ("list", Flist, Slist, 0, MANY, 0, | |||
| 2822 | doc: /* Return a newly created list with specified arguments as elements. | 2769 | doc: /* Return a newly created list with specified arguments as elements. |
| 2823 | Any number of arguments, even zero arguments, are allowed. | 2770 | Any number of arguments, even zero arguments, are allowed. |
| 2824 | usage: (list &rest OBJECTS) */) | 2771 | usage: (list &rest OBJECTS) */) |
| 2825 | (nargs, args) | 2772 | (int nargs, register Lisp_Object *args) |
| 2826 | int nargs; | ||
| 2827 | register Lisp_Object *args; | ||
| 2828 | { | 2773 | { |
| 2829 | register Lisp_Object val; | 2774 | register Lisp_Object val; |
| 2830 | val = Qnil; | 2775 | val = Qnil; |
| @@ -2840,8 +2785,7 @@ usage: (list &rest OBJECTS) */) | |||
| 2840 | 2785 | ||
| 2841 | DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0, | 2786 | DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0, |
| 2842 | doc: /* Return a newly created list of length LENGTH, with each element being INIT. */) | 2787 | doc: /* Return a newly created list of length LENGTH, with each element being INIT. */) |
| 2843 | (length, init) | 2788 | (register Lisp_Object length, Lisp_Object init) |
| 2844 | register Lisp_Object length, init; | ||
| 2845 | { | 2789 | { |
| 2846 | register Lisp_Object val; | 2790 | register Lisp_Object val; |
| 2847 | register int size; | 2791 | register int size; |
| @@ -2904,8 +2848,7 @@ static int n_vectors; | |||
| 2904 | with room for LEN Lisp_Objects. */ | 2848 | with room for LEN Lisp_Objects. */ |
| 2905 | 2849 | ||
| 2906 | static struct Lisp_Vector * | 2850 | static struct Lisp_Vector * |
| 2907 | allocate_vectorlike (len) | 2851 | allocate_vectorlike (EMACS_INT len) |
| 2908 | EMACS_INT len; | ||
| 2909 | { | 2852 | { |
| 2910 | struct Lisp_Vector *p; | 2853 | struct Lisp_Vector *p; |
| 2911 | size_t nbytes; | 2854 | size_t nbytes; |
| @@ -2946,8 +2889,7 @@ allocate_vectorlike (len) | |||
| 2946 | /* Allocate a vector with NSLOTS slots. */ | 2889 | /* Allocate a vector with NSLOTS slots. */ |
| 2947 | 2890 | ||
| 2948 | struct Lisp_Vector * | 2891 | struct Lisp_Vector * |
| 2949 | allocate_vector (nslots) | 2892 | allocate_vector (EMACS_INT nslots) |
| 2950 | EMACS_INT nslots; | ||
| 2951 | { | 2893 | { |
| 2952 | struct Lisp_Vector *v = allocate_vectorlike (nslots); | 2894 | struct Lisp_Vector *v = allocate_vectorlike (nslots); |
| 2953 | v->size = nslots; | 2895 | v->size = nslots; |
| @@ -2958,9 +2900,7 @@ allocate_vector (nslots) | |||
| 2958 | /* Allocate other vector-like structures. */ | 2900 | /* Allocate other vector-like structures. */ |
| 2959 | 2901 | ||
| 2960 | struct Lisp_Vector * | 2902 | struct Lisp_Vector * |
| 2961 | allocate_pseudovector (memlen, lisplen, tag) | 2903 | allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag) |
| 2962 | int memlen, lisplen; | ||
| 2963 | EMACS_INT tag; | ||
| 2964 | { | 2904 | { |
| 2965 | struct Lisp_Vector *v = allocate_vectorlike (memlen); | 2905 | struct Lisp_Vector *v = allocate_vectorlike (memlen); |
| 2966 | EMACS_INT i; | 2906 | EMACS_INT i; |
| @@ -2982,38 +2922,38 @@ allocate_hash_table (void) | |||
| 2982 | 2922 | ||
| 2983 | 2923 | ||
| 2984 | struct window * | 2924 | struct window * |
| 2985 | allocate_window () | 2925 | allocate_window (void) |
| 2986 | { | 2926 | { |
| 2987 | return ALLOCATE_PSEUDOVECTOR(struct window, current_matrix, PVEC_WINDOW); | 2927 | return ALLOCATE_PSEUDOVECTOR(struct window, current_matrix, PVEC_WINDOW); |
| 2988 | } | 2928 | } |
| 2989 | 2929 | ||
| 2990 | 2930 | ||
| 2991 | struct terminal * | 2931 | struct terminal * |
| 2992 | allocate_terminal () | 2932 | allocate_terminal (void) |
| 2993 | { | 2933 | { |
| 2994 | struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal, | 2934 | struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal, |
| 2995 | next_terminal, PVEC_TERMINAL); | 2935 | next_terminal, PVEC_TERMINAL); |
| 2996 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ | 2936 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ |
| 2997 | bzero (&(t->next_terminal), | 2937 | memset (&t->next_terminal, 0, |
| 2998 | ((char*)(t+1)) - ((char*)&(t->next_terminal))); | 2938 | (char*) (t + 1) - (char*) &t->next_terminal); |
| 2999 | 2939 | ||
| 3000 | return t; | 2940 | return t; |
| 3001 | } | 2941 | } |
| 3002 | 2942 | ||
| 3003 | struct frame * | 2943 | struct frame * |
| 3004 | allocate_frame () | 2944 | allocate_frame (void) |
| 3005 | { | 2945 | { |
| 3006 | struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame, | 2946 | struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame, |
| 3007 | face_cache, PVEC_FRAME); | 2947 | face_cache, PVEC_FRAME); |
| 3008 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ | 2948 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ |
| 3009 | bzero (&(f->face_cache), | 2949 | memset (&f->face_cache, 0, |
| 3010 | ((char*)(f+1)) - ((char*)&(f->face_cache))); | 2950 | (char *) (f + 1) - (char *) &f->face_cache); |
| 3011 | return f; | 2951 | return f; |
| 3012 | } | 2952 | } |
| 3013 | 2953 | ||
| 3014 | 2954 | ||
| 3015 | struct Lisp_Process * | 2955 | struct Lisp_Process * |
| 3016 | allocate_process () | 2956 | allocate_process (void) |
| 3017 | { | 2957 | { |
| 3018 | return ALLOCATE_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS); | 2958 | return ALLOCATE_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS); |
| 3019 | } | 2959 | } |
| @@ -3022,8 +2962,7 @@ allocate_process () | |||
| 3022 | DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0, | 2962 | DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0, |
| 3023 | doc: /* Return a newly created vector of length LENGTH, with each element being INIT. | 2963 | doc: /* Return a newly created vector of length LENGTH, with each element being INIT. |
| 3024 | See also the function `vector'. */) | 2964 | See also the function `vector'. */) |
| 3025 | (length, init) | 2965 | (register Lisp_Object length, Lisp_Object init) |
| 3026 | register Lisp_Object length, init; | ||
| 3027 | { | 2966 | { |
| 3028 | Lisp_Object vector; | 2967 | Lisp_Object vector; |
| 3029 | register EMACS_INT sizei; | 2968 | register EMACS_INT sizei; |
| @@ -3079,9 +3018,7 @@ DEFUN ("vector", Fvector, Svector, 0, MANY, 0, | |||
| 3079 | doc: /* Return a newly created vector with specified arguments as elements. | 3018 | doc: /* Return a newly created vector with specified arguments as elements. |
| 3080 | Any number of arguments, even zero arguments, are allowed. | 3019 | Any number of arguments, even zero arguments, are allowed. |
| 3081 | usage: (vector &rest OBJECTS) */) | 3020 | usage: (vector &rest OBJECTS) */) |
| 3082 | (nargs, args) | 3021 | (register int nargs, Lisp_Object *args) |
| 3083 | register int nargs; | ||
| 3084 | Lisp_Object *args; | ||
| 3085 | { | 3022 | { |
| 3086 | register Lisp_Object len, val; | 3023 | register Lisp_Object len, val; |
| 3087 | register int index; | 3024 | register int index; |
| @@ -3126,9 +3063,7 @@ stack size, (optional) doc string, and (optional) interactive spec. | |||
| 3126 | The first four arguments are required; at most six have any | 3063 | The first four arguments are required; at most six have any |
| 3127 | significance. | 3064 | significance. |
| 3128 | usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) | 3065 | usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) |
| 3129 | (nargs, args) | 3066 | (register int nargs, Lisp_Object *args) |
| 3130 | register int nargs; | ||
| 3131 | Lisp_Object *args; | ||
| 3132 | { | 3067 | { |
| 3133 | register Lisp_Object len, val; | 3068 | register Lisp_Object len, val; |
| 3134 | register int index; | 3069 | register int index; |
| @@ -3144,7 +3079,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT | |||
| 3144 | else | 3079 | else |
| 3145 | val = Fmake_vector (len, Qnil); | 3080 | val = Fmake_vector (len, Qnil); |
| 3146 | 3081 | ||
| 3147 | if (STRINGP (args[1]) && STRING_MULTIBYTE (args[1])) | 3082 | if (nargs > 1 && STRINGP (args[1]) && STRING_MULTIBYTE (args[1])) |
| 3148 | /* BYTECODE-STRING must have been produced by Emacs 20.2 or the | 3083 | /* BYTECODE-STRING must have been produced by Emacs 20.2 or the |
| 3149 | earlier because they produced a raw 8-bit string for byte-code | 3084 | earlier because they produced a raw 8-bit string for byte-code |
| 3150 | and now such a byte-code string is loaded as multibyte while | 3085 | and now such a byte-code string is loaded as multibyte while |
| @@ -3202,7 +3137,7 @@ static int n_symbol_blocks; | |||
| 3202 | /* Initialize symbol allocation. */ | 3137 | /* Initialize symbol allocation. */ |
| 3203 | 3138 | ||
| 3204 | static void | 3139 | static void |
| 3205 | init_symbol () | 3140 | init_symbol (void) |
| 3206 | { | 3141 | { |
| 3207 | symbol_block = NULL; | 3142 | symbol_block = NULL; |
| 3208 | symbol_block_index = SYMBOL_BLOCK_SIZE; | 3143 | symbol_block_index = SYMBOL_BLOCK_SIZE; |
| @@ -3214,8 +3149,7 @@ init_symbol () | |||
| 3214 | DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, | 3149 | DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, |
| 3215 | doc: /* Return a newly allocated uninterned symbol whose name is NAME. | 3150 | doc: /* Return a newly allocated uninterned symbol whose name is NAME. |
| 3216 | Its value and function definition are void, and its property list is nil. */) | 3151 | Its value and function definition are void, and its property list is nil. */) |
| 3217 | (name) | 3152 | (Lisp_Object name) |
| 3218 | Lisp_Object name; | ||
| 3219 | { | 3153 | { |
| 3220 | register Lisp_Object val; | 3154 | register Lisp_Object val; |
| 3221 | register struct Lisp_Symbol *p; | 3155 | register struct Lisp_Symbol *p; |
| @@ -3294,7 +3228,7 @@ static union Lisp_Misc *marker_free_list; | |||
| 3294 | static int n_marker_blocks; | 3228 | static int n_marker_blocks; |
| 3295 | 3229 | ||
| 3296 | static void | 3230 | static void |
| 3297 | init_marker () | 3231 | init_marker (void) |
| 3298 | { | 3232 | { |
| 3299 | marker_block = NULL; | 3233 | marker_block = NULL; |
| 3300 | marker_block_index = MARKER_BLOCK_SIZE; | 3234 | marker_block_index = MARKER_BLOCK_SIZE; |
| @@ -3305,7 +3239,7 @@ init_marker () | |||
| 3305 | /* Return a newly allocated Lisp_Misc object, with no substructure. */ | 3239 | /* Return a newly allocated Lisp_Misc object, with no substructure. */ |
| 3306 | 3240 | ||
| 3307 | Lisp_Object | 3241 | Lisp_Object |
| 3308 | allocate_misc () | 3242 | allocate_misc (void) |
| 3309 | { | 3243 | { |
| 3310 | Lisp_Object val; | 3244 | Lisp_Object val; |
| 3311 | 3245 | ||
| @@ -3347,8 +3281,7 @@ allocate_misc () | |||
| 3347 | /* Free a Lisp_Misc object */ | 3281 | /* Free a Lisp_Misc object */ |
| 3348 | 3282 | ||
| 3349 | void | 3283 | void |
| 3350 | free_misc (misc) | 3284 | free_misc (Lisp_Object misc) |
| 3351 | Lisp_Object misc; | ||
| 3352 | { | 3285 | { |
| 3353 | XMISCTYPE (misc) = Lisp_Misc_Free; | 3286 | XMISCTYPE (misc) = Lisp_Misc_Free; |
| 3354 | XMISC (misc)->u_free.chain = marker_free_list; | 3287 | XMISC (misc)->u_free.chain = marker_free_list; |
| @@ -3362,9 +3295,7 @@ free_misc (misc) | |||
| 3362 | The unwind function can get the C values back using XSAVE_VALUE. */ | 3295 | The unwind function can get the C values back using XSAVE_VALUE. */ |
| 3363 | 3296 | ||
| 3364 | Lisp_Object | 3297 | Lisp_Object |
| 3365 | make_save_value (pointer, integer) | 3298 | make_save_value (void *pointer, int integer) |
| 3366 | void *pointer; | ||
| 3367 | int integer; | ||
| 3368 | { | 3299 | { |
| 3369 | register Lisp_Object val; | 3300 | register Lisp_Object val; |
| 3370 | register struct Lisp_Save_Value *p; | 3301 | register struct Lisp_Save_Value *p; |
| @@ -3380,7 +3311,7 @@ make_save_value (pointer, integer) | |||
| 3380 | 3311 | ||
| 3381 | DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, | 3312 | DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, |
| 3382 | doc: /* Return a newly allocated marker which does not point at any place. */) | 3313 | doc: /* Return a newly allocated marker which does not point at any place. */) |
| 3383 | () | 3314 | (void) |
| 3384 | { | 3315 | { |
| 3385 | register Lisp_Object val; | 3316 | register Lisp_Object val; |
| 3386 | register struct Lisp_Marker *p; | 3317 | register struct Lisp_Marker *p; |
| @@ -3399,8 +3330,7 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, | |||
| 3399 | /* Put MARKER back on the free list after using it temporarily. */ | 3330 | /* Put MARKER back on the free list after using it temporarily. */ |
| 3400 | 3331 | ||
| 3401 | void | 3332 | void |
| 3402 | free_marker (marker) | 3333 | free_marker (Lisp_Object marker) |
| 3403 | Lisp_Object marker; | ||
| 3404 | { | 3334 | { |
| 3405 | unchain_marker (XMARKER (marker)); | 3335 | unchain_marker (XMARKER (marker)); |
| 3406 | free_misc (marker); | 3336 | free_misc (marker); |
| @@ -3414,9 +3344,7 @@ free_marker (marker) | |||
| 3414 | Any number of arguments, even zero arguments, are allowed. */ | 3344 | Any number of arguments, even zero arguments, are allowed. */ |
| 3415 | 3345 | ||
| 3416 | Lisp_Object | 3346 | Lisp_Object |
| 3417 | make_event_array (nargs, args) | 3347 | make_event_array (register int nargs, Lisp_Object *args) |
| 3418 | register int nargs; | ||
| 3419 | Lisp_Object *args; | ||
| 3420 | { | 3348 | { |
| 3421 | int i; | 3349 | int i; |
| 3422 | 3350 | ||
| @@ -3456,7 +3384,7 @@ make_event_array (nargs, args) | |||
| 3456 | /* Called if malloc returns zero. */ | 3384 | /* Called if malloc returns zero. */ |
| 3457 | 3385 | ||
| 3458 | void | 3386 | void |
| 3459 | memory_full () | 3387 | memory_full (void) |
| 3460 | { | 3388 | { |
| 3461 | int i; | 3389 | int i; |
| 3462 | 3390 | ||
| @@ -3496,7 +3424,7 @@ memory_full () | |||
| 3496 | and also directly from this file, in case we're not using ralloc.c. */ | 3424 | and also directly from this file, in case we're not using ralloc.c. */ |
| 3497 | 3425 | ||
| 3498 | void | 3426 | void |
| 3499 | refill_memory_reserve () | 3427 | refill_memory_reserve (void) |
| 3500 | { | 3428 | { |
| 3501 | #ifndef SYSTEM_MALLOC | 3429 | #ifndef SYSTEM_MALLOC |
| 3502 | if (spare_memory[0] == 0) | 3430 | if (spare_memory[0] == 0) |
| @@ -3544,7 +3472,7 @@ refill_memory_reserve () | |||
| 3544 | /* Initialize this part of alloc.c. */ | 3472 | /* Initialize this part of alloc.c. */ |
| 3545 | 3473 | ||
| 3546 | static void | 3474 | static void |
| 3547 | mem_init () | 3475 | mem_init (void) |
| 3548 | { | 3476 | { |
| 3549 | mem_z.left = mem_z.right = MEM_NIL; | 3477 | mem_z.left = mem_z.right = MEM_NIL; |
| 3550 | mem_z.parent = NULL; | 3478 | mem_z.parent = NULL; |
| @@ -3558,8 +3486,7 @@ mem_init () | |||
| 3558 | MEM_NIL if there is no node in the tree containing START. */ | 3486 | MEM_NIL if there is no node in the tree containing START. */ |
| 3559 | 3487 | ||
| 3560 | static INLINE struct mem_node * | 3488 | static INLINE struct mem_node * |
| 3561 | mem_find (start) | 3489 | mem_find (void *start) |
| 3562 | void *start; | ||
| 3563 | { | 3490 | { |
| 3564 | struct mem_node *p; | 3491 | struct mem_node *p; |
| 3565 | 3492 | ||
| @@ -3582,9 +3509,7 @@ mem_find (start) | |||
| 3582 | pointer to the node that was inserted. */ | 3509 | pointer to the node that was inserted. */ |
| 3583 | 3510 | ||
| 3584 | static struct mem_node * | 3511 | static struct mem_node * |
| 3585 | mem_insert (start, end, type) | 3512 | mem_insert (void *start, void *end, enum mem_type type) |
| 3586 | void *start, *end; | ||
| 3587 | enum mem_type type; | ||
| 3588 | { | 3513 | { |
| 3589 | struct mem_node *c, *parent, *x; | 3514 | struct mem_node *c, *parent, *x; |
| 3590 | 3515 | ||
| @@ -3656,8 +3581,7 @@ mem_insert (start, end, type) | |||
| 3656 | balance the tree, after node X has been inserted; X is always red. */ | 3581 | balance the tree, after node X has been inserted; X is always red. */ |
| 3657 | 3582 | ||
| 3658 | static void | 3583 | static void |
| 3659 | mem_insert_fixup (x) | 3584 | mem_insert_fixup (struct mem_node *x) |
| 3660 | struct mem_node *x; | ||
| 3661 | { | 3585 | { |
| 3662 | while (x != mem_root && x->parent->color == MEM_RED) | 3586 | while (x != mem_root && x->parent->color == MEM_RED) |
| 3663 | { | 3587 | { |
| @@ -3735,8 +3659,7 @@ mem_insert_fixup (x) | |||
| 3735 | b c a b */ | 3659 | b c a b */ |
| 3736 | 3660 | ||
| 3737 | static void | 3661 | static void |
| 3738 | mem_rotate_left (x) | 3662 | mem_rotate_left (struct mem_node *x) |
| 3739 | struct mem_node *x; | ||
| 3740 | { | 3663 | { |
| 3741 | struct mem_node *y; | 3664 | struct mem_node *y; |
| 3742 | 3665 | ||
| @@ -3775,8 +3698,7 @@ mem_rotate_left (x) | |||
| 3775 | a b b c */ | 3698 | a b b c */ |
| 3776 | 3699 | ||
| 3777 | static void | 3700 | static void |
| 3778 | mem_rotate_right (x) | 3701 | mem_rotate_right (struct mem_node *x) |
| 3779 | struct mem_node *x; | ||
| 3780 | { | 3702 | { |
| 3781 | struct mem_node *y = x->left; | 3703 | struct mem_node *y = x->left; |
| 3782 | 3704 | ||
| @@ -3805,8 +3727,7 @@ mem_rotate_right (x) | |||
| 3805 | /* Delete node Z from the tree. If Z is null or MEM_NIL, do nothing. */ | 3727 | /* Delete node Z from the tree. If Z is null or MEM_NIL, do nothing. */ |
| 3806 | 3728 | ||
| 3807 | static void | 3729 | static void |
| 3808 | mem_delete (z) | 3730 | mem_delete (struct mem_node *z) |
| 3809 | struct mem_node *z; | ||
| 3810 | { | 3731 | { |
| 3811 | struct mem_node *x, *y; | 3732 | struct mem_node *x, *y; |
| 3812 | 3733 | ||
| @@ -3860,8 +3781,7 @@ mem_delete (z) | |||
| 3860 | deletion. */ | 3781 | deletion. */ |
| 3861 | 3782 | ||
| 3862 | static void | 3783 | static void |
| 3863 | mem_delete_fixup (x) | 3784 | mem_delete_fixup (struct mem_node *x) |
| 3864 | struct mem_node *x; | ||
| 3865 | { | 3785 | { |
| 3866 | while (x != mem_root && x->color == MEM_BLACK) | 3786 | while (x != mem_root && x->color == MEM_BLACK) |
| 3867 | { | 3787 | { |
| @@ -3942,9 +3862,7 @@ mem_delete_fixup (x) | |||
| 3942 | the heap. M is a pointer to the mem_block for P. */ | 3862 | the heap. M is a pointer to the mem_block for P. */ |
| 3943 | 3863 | ||
| 3944 | static INLINE int | 3864 | static INLINE int |
| 3945 | live_string_p (m, p) | 3865 | live_string_p (struct mem_node *m, void *p) |
| 3946 | struct mem_node *m; | ||
| 3947 | void *p; | ||
| 3948 | { | 3866 | { |
| 3949 | if (m->type == MEM_TYPE_STRING) | 3867 | if (m->type == MEM_TYPE_STRING) |
| 3950 | { | 3868 | { |
| @@ -3967,9 +3885,7 @@ live_string_p (m, p) | |||
| 3967 | the heap. M is a pointer to the mem_block for P. */ | 3885 | the heap. M is a pointer to the mem_block for P. */ |
| 3968 | 3886 | ||
| 3969 | static INLINE int | 3887 | static INLINE int |
| 3970 | live_cons_p (m, p) | 3888 | live_cons_p (struct mem_node *m, void *p) |
| 3971 | struct mem_node *m; | ||
| 3972 | void *p; | ||
| 3973 | { | 3889 | { |
| 3974 | if (m->type == MEM_TYPE_CONS) | 3890 | if (m->type == MEM_TYPE_CONS) |
| 3975 | { | 3891 | { |
| @@ -3995,9 +3911,7 @@ live_cons_p (m, p) | |||
| 3995 | the heap. M is a pointer to the mem_block for P. */ | 3911 | the heap. M is a pointer to the mem_block for P. */ |
| 3996 | 3912 | ||
| 3997 | static INLINE int | 3913 | static INLINE int |
| 3998 | live_symbol_p (m, p) | 3914 | live_symbol_p (struct mem_node *m, void *p) |
| 3999 | struct mem_node *m; | ||
| 4000 | void *p; | ||
| 4001 | { | 3915 | { |
| 4002 | if (m->type == MEM_TYPE_SYMBOL) | 3916 | if (m->type == MEM_TYPE_SYMBOL) |
| 4003 | { | 3917 | { |
| @@ -4023,9 +3937,7 @@ live_symbol_p (m, p) | |||
| 4023 | the heap. M is a pointer to the mem_block for P. */ | 3937 | the heap. M is a pointer to the mem_block for P. */ |
| 4024 | 3938 | ||
| 4025 | static INLINE int | 3939 | static INLINE int |
| 4026 | live_float_p (m, p) | 3940 | live_float_p (struct mem_node *m, void *p) |
| 4027 | struct mem_node *m; | ||
| 4028 | void *p; | ||
| 4029 | { | 3941 | { |
| 4030 | if (m->type == MEM_TYPE_FLOAT) | 3942 | if (m->type == MEM_TYPE_FLOAT) |
| 4031 | { | 3943 | { |
| @@ -4049,9 +3961,7 @@ live_float_p (m, p) | |||
| 4049 | the heap. M is a pointer to the mem_block for P. */ | 3961 | the heap. M is a pointer to the mem_block for P. */ |
| 4050 | 3962 | ||
| 4051 | static INLINE int | 3963 | static INLINE int |
| 4052 | live_misc_p (m, p) | 3964 | live_misc_p (struct mem_node *m, void *p) |
| 4053 | struct mem_node *m; | ||
| 4054 | void *p; | ||
| 4055 | { | 3965 | { |
| 4056 | if (m->type == MEM_TYPE_MISC) | 3966 | if (m->type == MEM_TYPE_MISC) |
| 4057 | { | 3967 | { |
| @@ -4077,9 +3987,7 @@ live_misc_p (m, p) | |||
| 4077 | M is a pointer to the mem_block for P. */ | 3987 | M is a pointer to the mem_block for P. */ |
| 4078 | 3988 | ||
| 4079 | static INLINE int | 3989 | static INLINE int |
| 4080 | live_vector_p (m, p) | 3990 | live_vector_p (struct mem_node *m, void *p) |
| 4081 | struct mem_node *m; | ||
| 4082 | void *p; | ||
| 4083 | { | 3991 | { |
| 4084 | return (p == m->start && m->type == MEM_TYPE_VECTORLIKE); | 3992 | return (p == m->start && m->type == MEM_TYPE_VECTORLIKE); |
| 4085 | } | 3993 | } |
| @@ -4089,9 +3997,7 @@ live_vector_p (m, p) | |||
| 4089 | pointer to the mem_block for P. */ | 3997 | pointer to the mem_block for P. */ |
| 4090 | 3998 | ||
| 4091 | static INLINE int | 3999 | static INLINE int |
| 4092 | live_buffer_p (m, p) | 4000 | live_buffer_p (struct mem_node *m, void *p) |
| 4093 | struct mem_node *m; | ||
| 4094 | void *p; | ||
| 4095 | { | 4001 | { |
| 4096 | /* P must point to the start of the block, and the buffer | 4002 | /* P must point to the start of the block, and the buffer |
| 4097 | must not have been killed. */ | 4003 | must not have been killed. */ |
| @@ -4134,7 +4040,7 @@ static double avg_live; | |||
| 4134 | 4040 | ||
| 4135 | DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", | 4041 | DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", |
| 4136 | doc: /* Show information about live and zombie objects. */) | 4042 | doc: /* Show information about live and zombie objects. */) |
| 4137 | () | 4043 | (void) |
| 4138 | { | 4044 | { |
| 4139 | Lisp_Object args[8], zombie_list = Qnil; | 4045 | Lisp_Object args[8], zombie_list = Qnil; |
| 4140 | int i; | 4046 | int i; |
| @@ -4157,8 +4063,7 @@ DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", | |||
| 4157 | /* Mark OBJ if we can prove it's a Lisp_Object. */ | 4063 | /* Mark OBJ if we can prove it's a Lisp_Object. */ |
| 4158 | 4064 | ||
| 4159 | static INLINE void | 4065 | static INLINE void |
| 4160 | mark_maybe_object (obj) | 4066 | mark_maybe_object (Lisp_Object obj) |
| 4161 | Lisp_Object obj; | ||
| 4162 | { | 4067 | { |
| 4163 | void *po = (void *) XPNTR (obj); | 4068 | void *po = (void *) XPNTR (obj); |
| 4164 | struct mem_node *m = mem_find (po); | 4069 | struct mem_node *m = mem_find (po); |
| @@ -4221,8 +4126,7 @@ mark_maybe_object (obj) | |||
| 4221 | marked. */ | 4126 | marked. */ |
| 4222 | 4127 | ||
| 4223 | static INLINE void | 4128 | static INLINE void |
| 4224 | mark_maybe_pointer (p) | 4129 | mark_maybe_pointer (void *p) |
| 4225 | void *p; | ||
| 4226 | { | 4130 | { |
| 4227 | struct mem_node *m; | 4131 | struct mem_node *m; |
| 4228 | 4132 | ||
| @@ -4302,9 +4206,7 @@ mark_maybe_pointer (p) | |||
| 4302 | or END+OFFSET..START. */ | 4206 | or END+OFFSET..START. */ |
| 4303 | 4207 | ||
| 4304 | static void | 4208 | static void |
| 4305 | mark_memory (start, end, offset) | 4209 | mark_memory (void *start, void *end, int offset) |
| 4306 | void *start, *end; | ||
| 4307 | int offset; | ||
| 4308 | { | 4210 | { |
| 4309 | Lisp_Object *p; | 4211 | Lisp_Object *p; |
| 4310 | void **pp; | 4212 | void **pp; |
| @@ -4520,7 +4422,7 @@ dump_zombies () | |||
| 4520 | equally on the stack. */ | 4422 | equally on the stack. */ |
| 4521 | 4423 | ||
| 4522 | static void | 4424 | static void |
| 4523 | mark_stack () | 4425 | mark_stack (void) |
| 4524 | { | 4426 | { |
| 4525 | int i; | 4427 | int i; |
| 4526 | /* jmp_buf may not be aligned enough on darwin-ppc64 */ | 4428 | /* jmp_buf may not be aligned enough on darwin-ppc64 */ |
| @@ -4595,8 +4497,7 @@ mark_stack () | |||
| 4595 | 4497 | ||
| 4596 | /* Determine whether it is safe to access memory at address P. */ | 4498 | /* Determine whether it is safe to access memory at address P. */ |
| 4597 | static int | 4499 | static int |
| 4598 | valid_pointer_p (p) | 4500 | valid_pointer_p (void *p) |
| 4599 | void *p; | ||
| 4600 | { | 4501 | { |
| 4601 | #ifdef WINDOWSNT | 4502 | #ifdef WINDOWSNT |
| 4602 | return w32_valid_pointer_p (p, 16); | 4503 | return w32_valid_pointer_p (p, 16); |
| @@ -4627,8 +4528,7 @@ valid_pointer_p (p) | |||
| 4627 | so it should only be used in code for manual debugging. */ | 4528 | so it should only be used in code for manual debugging. */ |
| 4628 | 4529 | ||
| 4629 | int | 4530 | int |
| 4630 | valid_lisp_object_p (obj) | 4531 | valid_lisp_object_p (Lisp_Object obj) |
| 4631 | Lisp_Object obj; | ||
| 4632 | { | 4532 | { |
| 4633 | void *p; | 4533 | void *p; |
| 4634 | #if GC_MARK_STACK | 4534 | #if GC_MARK_STACK |
| @@ -4706,9 +4606,7 @@ valid_lisp_object_p (obj) | |||
| 4706 | allocated. TYPE < 0 means it's not used for a Lisp object. */ | 4606 | allocated. TYPE < 0 means it's not used for a Lisp object. */ |
| 4707 | 4607 | ||
| 4708 | static POINTER_TYPE * | 4608 | static POINTER_TYPE * |
| 4709 | pure_alloc (size, type) | 4609 | pure_alloc (size_t size, int type) |
| 4710 | size_t size; | ||
| 4711 | int type; | ||
| 4712 | { | 4610 | { |
| 4713 | POINTER_TYPE *result; | 4611 | POINTER_TYPE *result; |
| 4714 | #ifdef USE_LSB_TAG | 4612 | #ifdef USE_LSB_TAG |
| @@ -4762,7 +4660,7 @@ pure_alloc (size, type) | |||
| 4762 | /* Print a warning if PURESIZE is too small. */ | 4660 | /* Print a warning if PURESIZE is too small. */ |
| 4763 | 4661 | ||
| 4764 | void | 4662 | void |
| 4765 | check_pure_size () | 4663 | check_pure_size (void) |
| 4766 | { | 4664 | { |
| 4767 | if (pure_bytes_used_before_overflow) | 4665 | if (pure_bytes_used_before_overflow) |
| 4768 | message ("emacs:0:Pure Lisp storage overflow (approx. %d bytes needed)", | 4666 | message ("emacs:0:Pure Lisp storage overflow (approx. %d bytes needed)", |
| @@ -4775,9 +4673,7 @@ check_pure_size () | |||
| 4775 | address. Return NULL if not found. */ | 4673 | address. Return NULL if not found. */ |
| 4776 | 4674 | ||
| 4777 | static char * | 4675 | static char * |
| 4778 | find_string_data_in_pure (data, nbytes) | 4676 | find_string_data_in_pure (const char *data, int nbytes) |
| 4779 | const char *data; | ||
| 4780 | int nbytes; | ||
| 4781 | { | 4677 | { |
| 4782 | int i, skip, bm_skip[256], last_char_skip, infinity, start, start_max; | 4678 | int i, skip, bm_skip[256], last_char_skip, infinity, start, start_max; |
| 4783 | const unsigned char *p; | 4679 | const unsigned char *p; |
| @@ -4846,10 +4742,7 @@ find_string_data_in_pure (data, nbytes) | |||
| 4846 | string; then the string is not protected from gc. */ | 4742 | string; then the string is not protected from gc. */ |
| 4847 | 4743 | ||
| 4848 | Lisp_Object | 4744 | Lisp_Object |
| 4849 | make_pure_string (data, nchars, nbytes, multibyte) | 4745 | make_pure_string (const char *data, int nchars, int nbytes, int multibyte) |
| 4850 | const char *data; | ||
| 4851 | int nchars, nbytes; | ||
| 4852 | int multibyte; | ||
| 4853 | { | 4746 | { |
| 4854 | Lisp_Object string; | 4747 | Lisp_Object string; |
| 4855 | struct Lisp_String *s; | 4748 | struct Lisp_String *s; |
| @@ -4859,7 +4752,7 @@ make_pure_string (data, nchars, nbytes, multibyte) | |||
| 4859 | if (s->data == NULL) | 4752 | if (s->data == NULL) |
| 4860 | { | 4753 | { |
| 4861 | s->data = (unsigned char *) pure_alloc (nbytes + 1, -1); | 4754 | s->data = (unsigned char *) pure_alloc (nbytes + 1, -1); |
| 4862 | bcopy (data, s->data, nbytes); | 4755 | memcpy (s->data, data, nbytes); |
| 4863 | s->data[nbytes] = '\0'; | 4756 | s->data[nbytes] = '\0'; |
| 4864 | } | 4757 | } |
| 4865 | s->size = nchars; | 4758 | s->size = nchars; |
| @@ -4892,8 +4785,7 @@ make_pure_c_string (const char *data) | |||
| 4892 | of CAR as car and CDR as cdr. */ | 4785 | of CAR as car and CDR as cdr. */ |
| 4893 | 4786 | ||
| 4894 | Lisp_Object | 4787 | Lisp_Object |
| 4895 | pure_cons (car, cdr) | 4788 | pure_cons (Lisp_Object car, Lisp_Object cdr) |
| 4896 | Lisp_Object car, cdr; | ||
| 4897 | { | 4789 | { |
| 4898 | register Lisp_Object new; | 4790 | register Lisp_Object new; |
| 4899 | struct Lisp_Cons *p; | 4791 | struct Lisp_Cons *p; |
| @@ -4909,8 +4801,7 @@ pure_cons (car, cdr) | |||
| 4909 | /* Value is a float object with value NUM allocated from pure space. */ | 4801 | /* Value is a float object with value NUM allocated from pure space. */ |
| 4910 | 4802 | ||
| 4911 | static Lisp_Object | 4803 | static Lisp_Object |
| 4912 | make_pure_float (num) | 4804 | make_pure_float (double num) |
| 4913 | double num; | ||
| 4914 | { | 4805 | { |
| 4915 | register Lisp_Object new; | 4806 | register Lisp_Object new; |
| 4916 | struct Lisp_Float *p; | 4807 | struct Lisp_Float *p; |
| @@ -4926,8 +4817,7 @@ make_pure_float (num) | |||
| 4926 | pure space. */ | 4817 | pure space. */ |
| 4927 | 4818 | ||
| 4928 | Lisp_Object | 4819 | Lisp_Object |
| 4929 | make_pure_vector (len) | 4820 | make_pure_vector (EMACS_INT len) |
| 4930 | EMACS_INT len; | ||
| 4931 | { | 4821 | { |
| 4932 | Lisp_Object new; | 4822 | Lisp_Object new; |
| 4933 | struct Lisp_Vector *p; | 4823 | struct Lisp_Vector *p; |
| @@ -4944,8 +4834,7 @@ DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0, | |||
| 4944 | doc: /* Make a copy of object OBJ in pure storage. | 4834 | doc: /* Make a copy of object OBJ in pure storage. |
| 4945 | Recursively copies contents of vectors and cons cells. | 4835 | Recursively copies contents of vectors and cons cells. |
| 4946 | Does not copy symbols. Copies strings without text properties. */) | 4836 | Does not copy symbols. Copies strings without text properties. */) |
| 4947 | (obj) | 4837 | (register Lisp_Object obj) |
| 4948 | register Lisp_Object obj; | ||
| 4949 | { | 4838 | { |
| 4950 | if (NILP (Vpurify_flag)) | 4839 | if (NILP (Vpurify_flag)) |
| 4951 | return obj; | 4840 | return obj; |
| @@ -5010,8 +4899,7 @@ Does not copy symbols. Copies strings without text properties. */) | |||
| 5010 | VARADDRESS. */ | 4899 | VARADDRESS. */ |
| 5011 | 4900 | ||
| 5012 | void | 4901 | void |
| 5013 | staticpro (varaddress) | 4902 | staticpro (Lisp_Object *varaddress) |
| 5014 | Lisp_Object *varaddress; | ||
| 5015 | { | 4903 | { |
| 5016 | staticvec[staticidx++] = varaddress; | 4904 | staticvec[staticidx++] = varaddress; |
| 5017 | if (staticidx >= NSTATICS) | 4905 | if (staticidx >= NSTATICS) |
| @@ -5026,7 +4914,7 @@ staticpro (varaddress) | |||
| 5026 | /* Temporarily prevent garbage collection. */ | 4914 | /* Temporarily prevent garbage collection. */ |
| 5027 | 4915 | ||
| 5028 | int | 4916 | int |
| 5029 | inhibit_garbage_collection () | 4917 | inhibit_garbage_collection (void) |
| 5030 | { | 4918 | { |
| 5031 | int count = SPECPDL_INDEX (); | 4919 | int count = SPECPDL_INDEX (); |
| 5032 | int nbits = min (VALBITS, BITS_PER_INT); | 4920 | int nbits = min (VALBITS, BITS_PER_INT); |
| @@ -5047,7 +4935,7 @@ Garbage collection happens automatically if you cons more than | |||
| 5047 | (USED-STRINGS . FREE-STRINGS)) | 4935 | (USED-STRINGS . FREE-STRINGS)) |
| 5048 | However, if there was overflow in pure space, `garbage-collect' | 4936 | However, if there was overflow in pure space, `garbage-collect' |
| 5049 | returns nil, because real GC can't be done. */) | 4937 | returns nil, because real GC can't be done. */) |
| 5050 | () | 4938 | (void) |
| 5051 | { | 4939 | { |
| 5052 | register struct specbinding *bind; | 4940 | register struct specbinding *bind; |
| 5053 | struct catchtag *catch; | 4941 | struct catchtag *catch; |
| @@ -5130,9 +5018,9 @@ returns nil, because real GC can't be done. */) | |||
| 5130 | if (stack_copy) | 5018 | if (stack_copy) |
| 5131 | { | 5019 | { |
| 5132 | if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) | 5020 | if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) |
| 5133 | bcopy (stack_bottom, stack_copy, i); | 5021 | memcpy (stack_copy, stack_bottom, i); |
| 5134 | else | 5022 | else |
| 5135 | bcopy (&stack_top_variable, stack_copy, i); | 5023 | memcpy (stack_copy, &stack_top_variable, i); |
| 5136 | } | 5024 | } |
| 5137 | } | 5025 | } |
| 5138 | } | 5026 | } |
| @@ -5165,7 +5053,7 @@ returns nil, because real GC can't be done. */) | |||
| 5165 | 5053 | ||
| 5166 | #ifdef USE_GTK | 5054 | #ifdef USE_GTK |
| 5167 | { | 5055 | { |
| 5168 | extern void xg_mark_data (); | 5056 | extern void xg_mark_data (void); |
| 5169 | xg_mark_data (); | 5057 | xg_mark_data (); |
| 5170 | } | 5058 | } |
| 5171 | #endif | 5059 | #endif |
| @@ -5358,8 +5246,7 @@ returns nil, because real GC can't be done. */) | |||
| 5358 | only interesting objects referenced from glyphs are strings. */ | 5246 | only interesting objects referenced from glyphs are strings. */ |
| 5359 | 5247 | ||
| 5360 | static void | 5248 | static void |
| 5361 | mark_glyph_matrix (matrix) | 5249 | mark_glyph_matrix (struct glyph_matrix *matrix) |
| 5362 | struct glyph_matrix *matrix; | ||
| 5363 | { | 5250 | { |
| 5364 | struct glyph_row *row = matrix->rows; | 5251 | struct glyph_row *row = matrix->rows; |
| 5365 | struct glyph_row *end = row + matrix->nrows; | 5252 | struct glyph_row *end = row + matrix->nrows; |
| @@ -5385,8 +5272,7 @@ mark_glyph_matrix (matrix) | |||
| 5385 | /* Mark Lisp faces in the face cache C. */ | 5272 | /* Mark Lisp faces in the face cache C. */ |
| 5386 | 5273 | ||
| 5387 | static void | 5274 | static void |
| 5388 | mark_face_cache (c) | 5275 | mark_face_cache (struct face_cache *c) |
| 5389 | struct face_cache *c; | ||
| 5390 | { | 5276 | { |
| 5391 | if (c) | 5277 | if (c) |
| 5392 | { | 5278 | { |
| @@ -5421,8 +5307,7 @@ int last_marked_index; | |||
| 5421 | static int mark_object_loop_halt; | 5307 | static int mark_object_loop_halt; |
| 5422 | 5308 | ||
| 5423 | static void | 5309 | static void |
| 5424 | mark_vectorlike (ptr) | 5310 | mark_vectorlike (struct Lisp_Vector *ptr) |
| 5425 | struct Lisp_Vector *ptr; | ||
| 5426 | { | 5311 | { |
| 5427 | register EMACS_INT size = ptr->size; | 5312 | register EMACS_INT size = ptr->size; |
| 5428 | register int i; | 5313 | register int i; |
| @@ -5445,8 +5330,7 @@ mark_vectorlike (ptr) | |||
| 5445 | symbols. */ | 5330 | symbols. */ |
| 5446 | 5331 | ||
| 5447 | static void | 5332 | static void |
| 5448 | mark_char_table (ptr) | 5333 | mark_char_table (struct Lisp_Vector *ptr) |
| 5449 | struct Lisp_Vector *ptr; | ||
| 5450 | { | 5334 | { |
| 5451 | register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK; | 5335 | register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK; |
| 5452 | register int i; | 5336 | register int i; |
| @@ -5470,8 +5354,7 @@ mark_char_table (ptr) | |||
| 5470 | } | 5354 | } |
| 5471 | 5355 | ||
| 5472 | void | 5356 | void |
| 5473 | mark_object (arg) | 5357 | mark_object (Lisp_Object arg) |
| 5474 | Lisp_Object arg; | ||
| 5475 | { | 5358 | { |
| 5476 | register Lisp_Object obj = arg; | 5359 | register Lisp_Object obj = arg; |
| 5477 | #ifdef GC_CHECK_MARKED_OBJECTS | 5360 | #ifdef GC_CHECK_MARKED_OBJECTS |
| @@ -5780,8 +5663,7 @@ mark_object (arg) | |||
| 5780 | /* Mark the pointers in a buffer structure. */ | 5663 | /* Mark the pointers in a buffer structure. */ |
| 5781 | 5664 | ||
| 5782 | static void | 5665 | static void |
| 5783 | mark_buffer (buf) | 5666 | mark_buffer (Lisp_Object buf) |
| 5784 | Lisp_Object buf; | ||
| 5785 | { | 5667 | { |
| 5786 | register struct buffer *buffer = XBUFFER (buf); | 5668 | register struct buffer *buffer = XBUFFER (buf); |
| 5787 | register Lisp_Object *ptr, tmp; | 5669 | register Lisp_Object *ptr, tmp; |
| @@ -5848,8 +5730,7 @@ mark_terminals (void) | |||
| 5848 | either marked or does not need to be marked to survive. */ | 5730 | either marked or does not need to be marked to survive. */ |
| 5849 | 5731 | ||
| 5850 | int | 5732 | int |
| 5851 | survives_gc_p (obj) | 5733 | survives_gc_p (Lisp_Object obj) |
| 5852 | Lisp_Object obj; | ||
| 5853 | { | 5734 | { |
| 5854 | int survives_p; | 5735 | int survives_p; |
| 5855 | 5736 | ||
| @@ -5895,7 +5776,7 @@ survives_gc_p (obj) | |||
| 5895 | /* Sweep: find all structures not marked, and free them. */ | 5776 | /* Sweep: find all structures not marked, and free them. */ |
| 5896 | 5777 | ||
| 5897 | static void | 5778 | static void |
| 5898 | gc_sweep () | 5779 | gc_sweep (void) |
| 5899 | { | 5780 | { |
| 5900 | /* Remove or mark entries in weak hash tables. | 5781 | /* Remove or mark entries in weak hash tables. |
| 5901 | This must be done before any object is unmarked. */ | 5782 | This must be done before any object is unmarked. */ |
| @@ -6271,7 +6152,7 @@ DEFUN ("memory-limit", Fmemory_limit, Smemory_limit, 0, 0, 0, | |||
| 6271 | doc: /* Return the address of the last byte Emacs has allocated, divided by 1024. | 6152 | doc: /* Return the address of the last byte Emacs has allocated, divided by 1024. |
| 6272 | This may be helpful in debugging Emacs's memory usage. | 6153 | This may be helpful in debugging Emacs's memory usage. |
| 6273 | We divide the value by 1024 to make sure it fits in a Lisp integer. */) | 6154 | We divide the value by 1024 to make sure it fits in a Lisp integer. */) |
| 6274 | () | 6155 | (void) |
| 6275 | { | 6156 | { |
| 6276 | Lisp_Object end; | 6157 | Lisp_Object end; |
| 6277 | 6158 | ||
| @@ -6293,7 +6174,7 @@ objects consed. | |||
| 6293 | MISCS include overlays, markers, and some internal types. | 6174 | MISCS include overlays, markers, and some internal types. |
| 6294 | Frames, windows, buffers, and subprocesses count as vectors | 6175 | Frames, windows, buffers, and subprocesses count as vectors |
| 6295 | (but the contents of a buffer's text do not count here). */) | 6176 | (but the contents of a buffer's text do not count here). */) |
| 6296 | () | 6177 | (void) |
| 6297 | { | 6178 | { |
| 6298 | Lisp_Object consed[8]; | 6179 | Lisp_Object consed[8]; |
| 6299 | 6180 | ||
| @@ -6312,10 +6193,7 @@ Frames, windows, buffers, and subprocesses count as vectors | |||
| 6312 | int suppress_checking; | 6193 | int suppress_checking; |
| 6313 | 6194 | ||
| 6314 | void | 6195 | void |
| 6315 | die (msg, file, line) | 6196 | die (const char *msg, const char *file, int line) |
| 6316 | const char *msg; | ||
| 6317 | const char *file; | ||
| 6318 | int line; | ||
| 6319 | { | 6197 | { |
| 6320 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", | 6198 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", |
| 6321 | file, line, msg); | 6199 | file, line, msg); |
| @@ -6325,7 +6203,7 @@ die (msg, file, line) | |||
| 6325 | /* Initialization */ | 6203 | /* Initialization */ |
| 6326 | 6204 | ||
| 6327 | void | 6205 | void |
| 6328 | init_alloc_once () | 6206 | init_alloc_once (void) |
| 6329 | { | 6207 | { |
| 6330 | /* Used to do Vpurify_flag = Qt here, but Qt isn't set up yet! */ | 6208 | /* Used to do Vpurify_flag = Qt here, but Qt isn't set up yet! */ |
| 6331 | purebeg = PUREBEG; | 6209 | purebeg = PUREBEG; |
| @@ -6380,7 +6258,7 @@ init_alloc_once () | |||
| 6380 | } | 6258 | } |
| 6381 | 6259 | ||
| 6382 | void | 6260 | void |
| 6383 | init_alloc () | 6261 | init_alloc (void) |
| 6384 | { | 6262 | { |
| 6385 | gcprolist = 0; | 6263 | gcprolist = 0; |
| 6386 | byte_stack_list = 0; | 6264 | byte_stack_list = 0; |
| @@ -6394,7 +6272,7 @@ init_alloc () | |||
| 6394 | } | 6272 | } |
| 6395 | 6273 | ||
| 6396 | void | 6274 | void |
| 6397 | syms_of_alloc () | 6275 | syms_of_alloc (void) |
| 6398 | { | 6276 | { |
| 6399 | DEFVAR_INT ("gc-cons-threshold", &gc_cons_threshold, | 6277 | DEFVAR_INT ("gc-cons-threshold", &gc_cons_threshold, |
| 6400 | doc: /* *Number of bytes of consing between garbage collections. | 6278 | doc: /* *Number of bytes of consing between garbage collections. |