diff options
| author | Joakim Verona | 2010-08-27 10:58:44 +0200 |
|---|---|---|
| committer | Joakim Verona | 2010-08-27 10:58:44 +0200 |
| commit | 362120833bcbbaea94976b6701633e2ed75f6051 (patch) | |
| tree | 632690a24a934bb51a32303add5172d63b6b9e00 /src/alloc.c | |
| parent | 1800c4865b15a9e1154bf1f03d87d1aaf750a527 (diff) | |
| parent | 1a868076f51b5d6f1cf78117463e6f9c614551ec (diff) | |
| download | emacs-362120833bcbbaea94976b6701633e2ed75f6051.tar.gz emacs-362120833bcbbaea94976b6701633e2ed75f6051.zip | |
merge from trunk, fix conflicts
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 570 |
1 files changed, 211 insertions, 359 deletions
diff --git a/src/alloc.c b/src/alloc.c index e0f07cc5f5a..1f615a7d505 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 |
| @@ -218,16 +214,6 @@ int abort_on_gc; | |||
| 218 | 214 | ||
| 219 | int garbage_collection_messages; | 215 | int garbage_collection_messages; |
| 220 | 216 | ||
| 221 | #ifndef VIRT_ADDR_VARIES | ||
| 222 | extern | ||
| 223 | #endif /* VIRT_ADDR_VARIES */ | ||
| 224 | int malloc_sbrk_used; | ||
| 225 | |||
| 226 | #ifndef VIRT_ADDR_VARIES | ||
| 227 | extern | ||
| 228 | #endif /* VIRT_ADDR_VARIES */ | ||
| 229 | int malloc_sbrk_unused; | ||
| 230 | |||
| 231 | /* Number of live and free conses etc. */ | 217 | /* Number of live and free conses etc. */ |
| 232 | 218 | ||
| 233 | static int total_conses, total_markers, total_symbols, total_vector_size; | 219 | static int total_conses, total_markers, total_symbols, total_vector_size; |
| @@ -298,7 +284,7 @@ static EMACS_INT pure_bytes_used_non_lisp; | |||
| 298 | /* If nonzero, this is a warning delivered by malloc and not yet | 284 | /* If nonzero, this is a warning delivered by malloc and not yet |
| 299 | displayed. */ | 285 | displayed. */ |
| 300 | 286 | ||
| 301 | char *pending_malloc_warning; | 287 | const char *pending_malloc_warning; |
| 302 | 288 | ||
| 303 | /* Pre-computed signal argument for use when memory is exhausted. */ | 289 | /* Pre-computed signal argument for use when memory is exhausted. */ |
| 304 | 290 | ||
| @@ -329,23 +315,23 @@ Lisp_Object Vpost_gc_hook, Qpost_gc_hook; | |||
| 329 | Lisp_Object Vgc_elapsed; /* accumulated elapsed time in GC */ | 315 | Lisp_Object Vgc_elapsed; /* accumulated elapsed time in GC */ |
| 330 | EMACS_INT gcs_done; /* accumulated GCs */ | 316 | EMACS_INT gcs_done; /* accumulated GCs */ |
| 331 | 317 | ||
| 332 | static void mark_buffer P_ ((Lisp_Object)); | 318 | static void mark_buffer (Lisp_Object); |
| 333 | static void mark_terminals P_ ((void)); | 319 | static void mark_terminals (void); |
| 334 | extern void mark_kboards P_ ((void)); | 320 | extern void mark_kboards (void); |
| 335 | extern void mark_ttys P_ ((void)); | 321 | extern void mark_ttys (void); |
| 336 | extern void mark_backtrace P_ ((void)); | 322 | extern void mark_backtrace (void); |
| 337 | static void gc_sweep P_ ((void)); | 323 | static void gc_sweep (void); |
| 338 | static void mark_glyph_matrix P_ ((struct glyph_matrix *)); | 324 | static void mark_glyph_matrix (struct glyph_matrix *); |
| 339 | static void mark_face_cache P_ ((struct face_cache *)); | 325 | static void mark_face_cache (struct face_cache *); |
| 340 | 326 | ||
| 341 | #ifdef HAVE_WINDOW_SYSTEM | 327 | #ifdef HAVE_WINDOW_SYSTEM |
| 342 | extern void mark_fringe_data P_ ((void)); | 328 | extern void mark_fringe_data (void); |
| 343 | #endif /* HAVE_WINDOW_SYSTEM */ | 329 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 344 | 330 | ||
| 345 | static struct Lisp_String *allocate_string P_ ((void)); | 331 | static struct Lisp_String *allocate_string (void); |
| 346 | static void compact_small_strings P_ ((void)); | 332 | static void compact_small_strings (void); |
| 347 | static void free_large_strings P_ ((void)); | 333 | static void free_large_strings (void); |
| 348 | static void sweep_strings P_ ((void)); | 334 | static void sweep_strings (void); |
| 349 | 335 | ||
| 350 | extern int message_enable_multibyte; | 336 | extern int message_enable_multibyte; |
| 351 | 337 | ||
| @@ -369,9 +355,9 @@ enum mem_type | |||
| 369 | MEM_TYPE_VECTORLIKE | 355 | MEM_TYPE_VECTORLIKE |
| 370 | }; | 356 | }; |
| 371 | 357 | ||
| 372 | static POINTER_TYPE *lisp_align_malloc P_ ((size_t, enum mem_type)); | 358 | static POINTER_TYPE *lisp_align_malloc (size_t, enum mem_type); |
| 373 | static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type)); | 359 | static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); |
| 374 | void refill_memory_reserve (); | 360 | void refill_memory_reserve (void); |
| 375 | 361 | ||
| 376 | 362 | ||
| 377 | #if GC_MARK_STACK || defined GC_MALLOC_CHECK | 363 | #if GC_MARK_STACK || defined GC_MALLOC_CHECK |
| @@ -452,31 +438,30 @@ static void *min_heap_address, *max_heap_address; | |||
| 452 | static struct mem_node mem_z; | 438 | static struct mem_node mem_z; |
| 453 | #define MEM_NIL &mem_z | 439 | #define MEM_NIL &mem_z |
| 454 | 440 | ||
| 455 | static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type)); | 441 | static struct Lisp_Vector *allocate_vectorlike (EMACS_INT); |
| 456 | static struct Lisp_Vector *allocate_vectorlike P_ ((EMACS_INT)); | 442 | static void lisp_free (POINTER_TYPE *); |
| 457 | static void lisp_free P_ ((POINTER_TYPE *)); | 443 | static void mark_stack (void); |
| 458 | static void mark_stack P_ ((void)); | 444 | static int live_vector_p (struct mem_node *, void *); |
| 459 | static int live_vector_p P_ ((struct mem_node *, void *)); | 445 | static int live_buffer_p (struct mem_node *, void *); |
| 460 | static int live_buffer_p P_ ((struct mem_node *, void *)); | 446 | static int live_string_p (struct mem_node *, void *); |
| 461 | static int live_string_p P_ ((struct mem_node *, void *)); | 447 | static int live_cons_p (struct mem_node *, void *); |
| 462 | static int live_cons_p P_ ((struct mem_node *, void *)); | 448 | static int live_symbol_p (struct mem_node *, void *); |
| 463 | static int live_symbol_p P_ ((struct mem_node *, void *)); | 449 | static int live_float_p (struct mem_node *, void *); |
| 464 | static int live_float_p P_ ((struct mem_node *, void *)); | 450 | static int live_misc_p (struct mem_node *, void *); |
| 465 | static int live_misc_p P_ ((struct mem_node *, void *)); | 451 | static void mark_maybe_object (Lisp_Object); |
| 466 | static void mark_maybe_object P_ ((Lisp_Object)); | 452 | static void mark_memory (void *, void *, int); |
| 467 | static void mark_memory P_ ((void *, void *, int)); | 453 | static void mem_init (void); |
| 468 | static void mem_init P_ ((void)); | 454 | static struct mem_node *mem_insert (void *, void *, enum mem_type); |
| 469 | static struct mem_node *mem_insert P_ ((void *, void *, enum mem_type)); | 455 | static void mem_insert_fixup (struct mem_node *); |
| 470 | static void mem_insert_fixup P_ ((struct mem_node *)); | 456 | static void mem_rotate_left (struct mem_node *); |
| 471 | static void mem_rotate_left P_ ((struct mem_node *)); | 457 | static void mem_rotate_right (struct mem_node *); |
| 472 | static void mem_rotate_right P_ ((struct mem_node *)); | 458 | static void mem_delete (struct mem_node *); |
| 473 | static void mem_delete P_ ((struct mem_node *)); | 459 | static void mem_delete_fixup (struct mem_node *); |
| 474 | static void mem_delete_fixup P_ ((struct mem_node *)); | 460 | static INLINE struct mem_node *mem_find (void *); |
| 475 | static INLINE struct mem_node *mem_find P_ ((void *)); | ||
| 476 | 461 | ||
| 477 | 462 | ||
| 478 | #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS | 463 | #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS |
| 479 | static void check_gcpros P_ ((void)); | 464 | static void check_gcpros (void); |
| 480 | #endif | 465 | #endif |
| 481 | 466 | ||
| 482 | #endif /* GC_MARK_STACK || GC_MALLOC_CHECK */ | 467 | #endif /* GC_MARK_STACK || GC_MALLOC_CHECK */ |
| @@ -495,7 +480,7 @@ static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag}; | |||
| 495 | 480 | ||
| 496 | static int staticidx = 0; | 481 | static int staticidx = 0; |
| 497 | 482 | ||
| 498 | static POINTER_TYPE *pure_alloc P_ ((size_t, int)); | 483 | static POINTER_TYPE *pure_alloc (size_t, int); |
| 499 | 484 | ||
| 500 | 485 | ||
| 501 | /* Value is SZ rounded up to the next multiple of ALIGNMENT. | 486 | /* Value is SZ rounded up to the next multiple of ALIGNMENT. |
| @@ -514,8 +499,7 @@ static POINTER_TYPE *pure_alloc P_ ((size_t, int)); | |||
| 514 | /* Function malloc calls this if it finds we are near exhausting storage. */ | 499 | /* Function malloc calls this if it finds we are near exhausting storage. */ |
| 515 | 500 | ||
| 516 | void | 501 | void |
| 517 | malloc_warning (str) | 502 | malloc_warning (const char *str) |
| 518 | char *str; | ||
| 519 | { | 503 | { |
| 520 | pending_malloc_warning = str; | 504 | pending_malloc_warning = str; |
| 521 | } | 505 | } |
| @@ -524,7 +508,7 @@ malloc_warning (str) | |||
| 524 | /* Display an already-pending malloc warning. */ | 508 | /* Display an already-pending malloc warning. */ |
| 525 | 509 | ||
| 526 | void | 510 | void |
| 527 | display_malloc_warning () | 511 | display_malloc_warning (void) |
| 528 | { | 512 | { |
| 529 | call3 (intern ("display-warning"), | 513 | call3 (intern ("display-warning"), |
| 530 | intern ("alloc"), | 514 | intern ("alloc"), |
| @@ -543,7 +527,7 @@ display_malloc_warning () | |||
| 543 | /* Called if we can't allocate relocatable space for a buffer. */ | 527 | /* Called if we can't allocate relocatable space for a buffer. */ |
| 544 | 528 | ||
| 545 | void | 529 | void |
| 546 | buffer_memory_full () | 530 | buffer_memory_full (void) |
| 547 | { | 531 | { |
| 548 | /* If buffers use the relocating allocator, no need to free | 532 | /* If buffers use the relocating allocator, no need to free |
| 549 | spare_memory, because we may have plenty of malloc space left | 533 | spare_memory, because we may have plenty of malloc space left |
| @@ -637,10 +621,12 @@ overrun_check_malloc (size) | |||
| 637 | val = (unsigned char *) malloc (size + overhead); | 621 | val = (unsigned char *) malloc (size + overhead); |
| 638 | if (val && check_depth == 1) | 622 | if (val && check_depth == 1) |
| 639 | { | 623 | { |
| 640 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); | 624 | memcpy (val, xmalloc_overrun_check_header, |
| 625 | XMALLOC_OVERRUN_CHECK_SIZE - 4); | ||
| 641 | val += XMALLOC_OVERRUN_CHECK_SIZE; | 626 | val += XMALLOC_OVERRUN_CHECK_SIZE; |
| 642 | XMALLOC_PUT_SIZE(val, size); | 627 | XMALLOC_PUT_SIZE(val, size); |
| 643 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); | 628 | memcpy (val + size, xmalloc_overrun_check_trailer, |
| 629 | XMALLOC_OVERRUN_CHECK_SIZE); | ||
| 644 | } | 630 | } |
| 645 | --check_depth; | 631 | --check_depth; |
| 646 | return (POINTER_TYPE *)val; | 632 | return (POINTER_TYPE *)val; |
| @@ -660,28 +646,29 @@ overrun_check_realloc (block, size) | |||
| 660 | 646 | ||
| 661 | if (val | 647 | if (val |
| 662 | && check_depth == 1 | 648 | && check_depth == 1 |
| 663 | && bcmp (xmalloc_overrun_check_header, | 649 | && memcmp (xmalloc_overrun_check_header, |
| 664 | val - XMALLOC_OVERRUN_CHECK_SIZE, | 650 | val - XMALLOC_OVERRUN_CHECK_SIZE, |
| 665 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) | 651 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) |
| 666 | { | 652 | { |
| 667 | size_t osize = XMALLOC_GET_SIZE (val); | 653 | size_t osize = XMALLOC_GET_SIZE (val); |
| 668 | if (bcmp (xmalloc_overrun_check_trailer, | 654 | if (memcmp (xmalloc_overrun_check_trailer, val + osize, |
| 669 | val + osize, | 655 | XMALLOC_OVERRUN_CHECK_SIZE)) |
| 670 | XMALLOC_OVERRUN_CHECK_SIZE)) | ||
| 671 | abort (); | 656 | abort (); |
| 672 | bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); | 657 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 673 | val -= XMALLOC_OVERRUN_CHECK_SIZE; | 658 | val -= XMALLOC_OVERRUN_CHECK_SIZE; |
| 674 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); | 659 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 675 | } | 660 | } |
| 676 | 661 | ||
| 677 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); | 662 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); |
| 678 | 663 | ||
| 679 | if (val && check_depth == 1) | 664 | if (val && check_depth == 1) |
| 680 | { | 665 | { |
| 681 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); | 666 | memcpy (val, xmalloc_overrun_check_header, |
| 667 | XMALLOC_OVERRUN_CHECK_SIZE - 4); | ||
| 682 | val += XMALLOC_OVERRUN_CHECK_SIZE; | 668 | val += XMALLOC_OVERRUN_CHECK_SIZE; |
| 683 | XMALLOC_PUT_SIZE(val, size); | 669 | XMALLOC_PUT_SIZE(val, size); |
| 684 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); | 670 | memcpy (val + size, xmalloc_overrun_check_trailer, |
| 671 | XMALLOC_OVERRUN_CHECK_SIZE); | ||
| 685 | } | 672 | } |
| 686 | --check_depth; | 673 | --check_depth; |
| 687 | return (POINTER_TYPE *)val; | 674 | return (POINTER_TYPE *)val; |
| @@ -698,22 +685,21 @@ overrun_check_free (block) | |||
| 698 | ++check_depth; | 685 | ++check_depth; |
| 699 | if (val | 686 | if (val |
| 700 | && check_depth == 1 | 687 | && check_depth == 1 |
| 701 | && bcmp (xmalloc_overrun_check_header, | 688 | && memcmp (xmalloc_overrun_check_header, |
| 702 | val - XMALLOC_OVERRUN_CHECK_SIZE, | 689 | val - XMALLOC_OVERRUN_CHECK_SIZE, |
| 703 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) | 690 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) |
| 704 | { | 691 | { |
| 705 | size_t osize = XMALLOC_GET_SIZE (val); | 692 | size_t osize = XMALLOC_GET_SIZE (val); |
| 706 | if (bcmp (xmalloc_overrun_check_trailer, | 693 | if (memcmp (xmalloc_overrun_check_trailer, val + osize, |
| 707 | val + osize, | 694 | XMALLOC_OVERRUN_CHECK_SIZE)) |
| 708 | XMALLOC_OVERRUN_CHECK_SIZE)) | ||
| 709 | abort (); | 695 | abort (); |
| 710 | #ifdef XMALLOC_CLEAR_FREE_MEMORY | 696 | #ifdef XMALLOC_CLEAR_FREE_MEMORY |
| 711 | val -= XMALLOC_OVERRUN_CHECK_SIZE; | 697 | val -= XMALLOC_OVERRUN_CHECK_SIZE; |
| 712 | memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2); | 698 | memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2); |
| 713 | #else | 699 | #else |
| 714 | bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); | 700 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 715 | val -= XMALLOC_OVERRUN_CHECK_SIZE; | 701 | val -= XMALLOC_OVERRUN_CHECK_SIZE; |
| 716 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); | 702 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 717 | #endif | 703 | #endif |
| 718 | } | 704 | } |
| 719 | 705 | ||
| @@ -742,8 +728,7 @@ overrun_check_free (block) | |||
| 742 | /* Like malloc but check for no memory and block interrupt input.. */ | 728 | /* Like malloc but check for no memory and block interrupt input.. */ |
| 743 | 729 | ||
| 744 | POINTER_TYPE * | 730 | POINTER_TYPE * |
| 745 | xmalloc (size) | 731 | xmalloc (size_t size) |
| 746 | size_t size; | ||
| 747 | { | 732 | { |
| 748 | register POINTER_TYPE *val; | 733 | register POINTER_TYPE *val; |
| 749 | 734 | ||
| @@ -760,9 +745,7 @@ xmalloc (size) | |||
| 760 | /* Like realloc but check for no memory and block interrupt input.. */ | 745 | /* Like realloc but check for no memory and block interrupt input.. */ |
| 761 | 746 | ||
| 762 | POINTER_TYPE * | 747 | POINTER_TYPE * |
| 763 | xrealloc (block, size) | 748 | xrealloc (POINTER_TYPE *block, size_t size) |
| 764 | POINTER_TYPE *block; | ||
| 765 | size_t size; | ||
| 766 | { | 749 | { |
| 767 | register POINTER_TYPE *val; | 750 | register POINTER_TYPE *val; |
| 768 | 751 | ||
| @@ -783,8 +766,7 @@ xrealloc (block, size) | |||
| 783 | /* Like free but block interrupt input. */ | 766 | /* Like free but block interrupt input. */ |
| 784 | 767 | ||
| 785 | void | 768 | void |
| 786 | xfree (block) | 769 | xfree (POINTER_TYPE *block) |
| 787 | POINTER_TYPE *block; | ||
| 788 | { | 770 | { |
| 789 | if (!block) | 771 | if (!block) |
| 790 | return; | 772 | return; |
| @@ -800,12 +782,11 @@ xfree (block) | |||
| 800 | /* Like strdup, but uses xmalloc. */ | 782 | /* Like strdup, but uses xmalloc. */ |
| 801 | 783 | ||
| 802 | char * | 784 | char * |
| 803 | xstrdup (s) | 785 | xstrdup (const char *s) |
| 804 | const char *s; | ||
| 805 | { | 786 | { |
| 806 | size_t len = strlen (s) + 1; | 787 | size_t len = strlen (s) + 1; |
| 807 | char *p = (char *) xmalloc (len); | 788 | char *p = (char *) xmalloc (len); |
| 808 | bcopy (s, p, len); | 789 | memcpy (p, s, len); |
| 809 | return p; | 790 | return p; |
| 810 | } | 791 | } |
| 811 | 792 | ||
| @@ -813,8 +794,7 @@ xstrdup (s) | |||
| 813 | /* Unwind for SAFE_ALLOCA */ | 794 | /* Unwind for SAFE_ALLOCA */ |
| 814 | 795 | ||
| 815 | Lisp_Object | 796 | Lisp_Object |
| 816 | safe_alloca_unwind (arg) | 797 | safe_alloca_unwind (Lisp_Object arg) |
| 817 | Lisp_Object arg; | ||
| 818 | { | 798 | { |
| 819 | register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); | 799 | register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); |
| 820 | 800 | ||
| @@ -835,9 +815,7 @@ static void *lisp_malloc_loser; | |||
| 835 | #endif | 815 | #endif |
| 836 | 816 | ||
| 837 | static POINTER_TYPE * | 817 | static POINTER_TYPE * |
| 838 | lisp_malloc (nbytes, type) | 818 | lisp_malloc (size_t nbytes, enum mem_type type) |
| 839 | size_t nbytes; | ||
| 840 | enum mem_type type; | ||
| 841 | { | 819 | { |
| 842 | register void *val; | 820 | register void *val; |
| 843 | 821 | ||
| @@ -881,8 +859,7 @@ lisp_malloc (nbytes, type) | |||
| 881 | call to lisp_malloc. */ | 859 | call to lisp_malloc. */ |
| 882 | 860 | ||
| 883 | static void | 861 | static void |
| 884 | lisp_free (block) | 862 | lisp_free (POINTER_TYPE *block) |
| 885 | POINTER_TYPE *block; | ||
| 886 | { | 863 | { |
| 887 | MALLOC_BLOCK_INPUT; | 864 | MALLOC_BLOCK_INPUT; |
| 888 | free (block); | 865 | free (block); |
| @@ -981,9 +958,7 @@ static struct ablock *free_ablock; | |||
| 981 | Alignment is on a multiple of BLOCK_ALIGN and `nbytes' has to be | 958 | Alignment is on a multiple of BLOCK_ALIGN and `nbytes' has to be |
| 982 | smaller or equal to BLOCK_BYTES. */ | 959 | smaller or equal to BLOCK_BYTES. */ |
| 983 | static POINTER_TYPE * | 960 | static POINTER_TYPE * |
| 984 | lisp_align_malloc (nbytes, type) | 961 | lisp_align_malloc (size_t nbytes, enum mem_type type) |
| 985 | size_t nbytes; | ||
| 986 | enum mem_type type; | ||
| 987 | { | 962 | { |
| 988 | void *base, *val; | 963 | void *base, *val; |
| 989 | struct ablocks *abase; | 964 | struct ablocks *abase; |
| @@ -1090,8 +1065,7 @@ lisp_align_malloc (nbytes, type) | |||
| 1090 | } | 1065 | } |
| 1091 | 1066 | ||
| 1092 | static void | 1067 | static void |
| 1093 | lisp_align_free (block) | 1068 | lisp_align_free (POINTER_TYPE *block) |
| 1094 | POINTER_TYPE *block; | ||
| 1095 | { | 1069 | { |
| 1096 | struct ablock *ablock = block; | 1070 | struct ablock *ablock = block; |
| 1097 | struct ablocks *abase = ABLOCK_ABASE (ablock); | 1071 | struct ablocks *abase = ABLOCK_ABASE (ablock); |
| @@ -1136,7 +1110,7 @@ lisp_align_free (block) | |||
| 1136 | a call to lisp_malloc. */ | 1110 | a call to lisp_malloc. */ |
| 1137 | 1111 | ||
| 1138 | struct buffer * | 1112 | struct buffer * |
| 1139 | allocate_buffer () | 1113 | allocate_buffer (void) |
| 1140 | { | 1114 | { |
| 1141 | struct buffer *b | 1115 | struct buffer *b |
| 1142 | = (struct buffer *) lisp_malloc (sizeof (struct buffer), | 1116 | = (struct buffer *) lisp_malloc (sizeof (struct buffer), |
| @@ -1164,21 +1138,19 @@ allocate_buffer () | |||
| 1164 | there's no need to block input around malloc. */ | 1138 | there's no need to block input around malloc. */ |
| 1165 | 1139 | ||
| 1166 | #ifndef DOUG_LEA_MALLOC | 1140 | #ifndef DOUG_LEA_MALLOC |
| 1167 | extern void * (*__malloc_hook) P_ ((size_t, const void *)); | 1141 | extern void * (*__malloc_hook) (size_t, const void *); |
| 1168 | extern void * (*__realloc_hook) P_ ((void *, size_t, const void *)); | 1142 | extern void * (*__realloc_hook) (void *, size_t, const void *); |
| 1169 | extern void (*__free_hook) P_ ((void *, const void *)); | 1143 | extern void (*__free_hook) (void *, const void *); |
| 1170 | /* Else declared in malloc.h, perhaps with an extra arg. */ | 1144 | /* Else declared in malloc.h, perhaps with an extra arg. */ |
| 1171 | #endif /* DOUG_LEA_MALLOC */ | 1145 | #endif /* DOUG_LEA_MALLOC */ |
| 1172 | static void * (*old_malloc_hook) P_ ((size_t, const void *)); | 1146 | static void * (*old_malloc_hook) (size_t, const void *); |
| 1173 | static void * (*old_realloc_hook) P_ ((void *, size_t, const void*)); | 1147 | static void * (*old_realloc_hook) (void *, size_t, const void*); |
| 1174 | static void (*old_free_hook) P_ ((void*, const void*)); | 1148 | static void (*old_free_hook) (void*, const void*); |
| 1175 | 1149 | ||
| 1176 | /* This function is used as the hook for free to call. */ | 1150 | /* This function is used as the hook for free to call. */ |
| 1177 | 1151 | ||
| 1178 | static void | 1152 | static void |
| 1179 | emacs_blocked_free (ptr, ptr2) | 1153 | emacs_blocked_free (void *ptr, const void *ptr2) |
| 1180 | void *ptr; | ||
| 1181 | const void *ptr2; | ||
| 1182 | { | 1154 | { |
| 1183 | BLOCK_INPUT_ALLOC; | 1155 | BLOCK_INPUT_ALLOC; |
| 1184 | 1156 | ||
| @@ -1226,9 +1198,7 @@ emacs_blocked_free (ptr, ptr2) | |||
| 1226 | /* This function is the malloc hook that Emacs uses. */ | 1198 | /* This function is the malloc hook that Emacs uses. */ |
| 1227 | 1199 | ||
| 1228 | static void * | 1200 | static void * |
| 1229 | emacs_blocked_malloc (size, ptr) | 1201 | emacs_blocked_malloc (size_t size, const void *ptr) |
| 1230 | size_t size; | ||
| 1231 | const void *ptr; | ||
| 1232 | { | 1202 | { |
| 1233 | void *value; | 1203 | void *value; |
| 1234 | 1204 | ||
| @@ -1275,10 +1245,7 @@ emacs_blocked_malloc (size, ptr) | |||
| 1275 | /* This function is the realloc hook that Emacs uses. */ | 1245 | /* This function is the realloc hook that Emacs uses. */ |
| 1276 | 1246 | ||
| 1277 | static void * | 1247 | static void * |
| 1278 | emacs_blocked_realloc (ptr, size, ptr2) | 1248 | emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2) |
| 1279 | void *ptr; | ||
| 1280 | size_t size; | ||
| 1281 | const void *ptr2; | ||
| 1282 | { | 1249 | { |
| 1283 | void *value; | 1250 | void *value; |
| 1284 | 1251 | ||
| @@ -1352,7 +1319,7 @@ reset_malloc_hooks () | |||
| 1352 | /* Called from main to set up malloc to use our hooks. */ | 1319 | /* Called from main to set up malloc to use our hooks. */ |
| 1353 | 1320 | ||
| 1354 | void | 1321 | void |
| 1355 | uninterrupt_malloc () | 1322 | uninterrupt_malloc (void) |
| 1356 | { | 1323 | { |
| 1357 | #ifdef HAVE_GTK_AND_PTHREAD | 1324 | #ifdef HAVE_GTK_AND_PTHREAD |
| 1358 | #ifdef DOUG_LEA_MALLOC | 1325 | #ifdef DOUG_LEA_MALLOC |
| @@ -1434,7 +1401,7 @@ static int n_interval_blocks; | |||
| 1434 | /* Initialize interval allocation. */ | 1401 | /* Initialize interval allocation. */ |
| 1435 | 1402 | ||
| 1436 | static void | 1403 | static void |
| 1437 | init_intervals () | 1404 | init_intervals (void) |
| 1438 | { | 1405 | { |
| 1439 | interval_block = NULL; | 1406 | interval_block = NULL; |
| 1440 | interval_block_index = INTERVAL_BLOCK_SIZE; | 1407 | interval_block_index = INTERVAL_BLOCK_SIZE; |
| @@ -1446,7 +1413,7 @@ init_intervals () | |||
| 1446 | /* Return a new interval. */ | 1413 | /* Return a new interval. */ |
| 1447 | 1414 | ||
| 1448 | INTERVAL | 1415 | INTERVAL |
| 1449 | make_interval () | 1416 | make_interval (void) |
| 1450 | { | 1417 | { |
| 1451 | INTERVAL val; | 1418 | INTERVAL val; |
| 1452 | 1419 | ||
| @@ -1489,9 +1456,7 @@ make_interval () | |||
| 1489 | /* Mark Lisp objects in interval I. */ | 1456 | /* Mark Lisp objects in interval I. */ |
| 1490 | 1457 | ||
| 1491 | static void | 1458 | static void |
| 1492 | mark_interval (i, dummy) | 1459 | mark_interval (register INTERVAL i, Lisp_Object dummy) |
| 1493 | register INTERVAL i; | ||
| 1494 | Lisp_Object dummy; | ||
| 1495 | { | 1460 | { |
| 1496 | eassert (!i->gcmarkbit); /* Intervals are never shared. */ | 1461 | eassert (!i->gcmarkbit); /* Intervals are never shared. */ |
| 1497 | i->gcmarkbit = 1; | 1462 | i->gcmarkbit = 1; |
| @@ -1503,8 +1468,7 @@ mark_interval (i, dummy) | |||
| 1503 | use the macro MARK_INTERVAL_TREE instead. */ | 1468 | use the macro MARK_INTERVAL_TREE instead. */ |
| 1504 | 1469 | ||
| 1505 | static void | 1470 | static void |
| 1506 | mark_interval_tree (tree) | 1471 | mark_interval_tree (register INTERVAL tree) |
| 1507 | register INTERVAL tree; | ||
| 1508 | { | 1472 | { |
| 1509 | /* No need to test if this tree has been marked already; this | 1473 | /* No need to test if this tree has been marked already; this |
| 1510 | function is always called through the MARK_INTERVAL_TREE macro, | 1474 | function is always called through the MARK_INTERVAL_TREE macro, |
| @@ -1751,7 +1715,7 @@ static char string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = | |||
| 1751 | /* Initialize string allocation. Called from init_alloc_once. */ | 1715 | /* Initialize string allocation. Called from init_alloc_once. */ |
| 1752 | 1716 | ||
| 1753 | static void | 1717 | static void |
| 1754 | init_strings () | 1718 | init_strings (void) |
| 1755 | { | 1719 | { |
| 1756 | total_strings = total_free_strings = total_string_size = 0; | 1720 | total_strings = total_free_strings = total_string_size = 0; |
| 1757 | oldest_sblock = current_sblock = large_sblocks = NULL; | 1721 | oldest_sblock = current_sblock = large_sblocks = NULL; |
| @@ -1767,8 +1731,8 @@ init_strings () | |||
| 1767 | 1731 | ||
| 1768 | static int check_string_bytes_count; | 1732 | static int check_string_bytes_count; |
| 1769 | 1733 | ||
| 1770 | static void check_string_bytes P_ ((int)); | 1734 | static void check_string_bytes (int); |
| 1771 | static void check_sblock P_ ((struct sblock *)); | 1735 | static void check_sblock (struct sblock *); |
| 1772 | 1736 | ||
| 1773 | #define CHECK_STRING_BYTES(S) STRING_BYTES (S) | 1737 | #define CHECK_STRING_BYTES(S) STRING_BYTES (S) |
| 1774 | 1738 | ||
| @@ -1873,7 +1837,7 @@ check_string_free_list () | |||
| 1873 | /* Return a new Lisp_String. */ | 1837 | /* Return a new Lisp_String. */ |
| 1874 | 1838 | ||
| 1875 | static struct Lisp_String * | 1839 | static struct Lisp_String * |
| 1876 | allocate_string () | 1840 | allocate_string (void) |
| 1877 | { | 1841 | { |
| 1878 | struct Lisp_String *s; | 1842 | struct Lisp_String *s; |
| 1879 | 1843 | ||
| @@ -1889,7 +1853,7 @@ allocate_string () | |||
| 1889 | int i; | 1853 | int i; |
| 1890 | 1854 | ||
| 1891 | b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING); | 1855 | b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING); |
| 1892 | bzero (b, sizeof *b); | 1856 | memset (b, 0, sizeof *b); |
| 1893 | b->next = string_blocks; | 1857 | b->next = string_blocks; |
| 1894 | string_blocks = b; | 1858 | string_blocks = b; |
| 1895 | ++n_string_blocks; | 1859 | ++n_string_blocks; |
| @@ -1913,7 +1877,7 @@ allocate_string () | |||
| 1913 | MALLOC_UNBLOCK_INPUT; | 1877 | MALLOC_UNBLOCK_INPUT; |
| 1914 | 1878 | ||
| 1915 | /* Probably not strictly necessary, but play it safe. */ | 1879 | /* Probably not strictly necessary, but play it safe. */ |
| 1916 | bzero (s, sizeof *s); | 1880 | memset (s, 0, sizeof *s); |
| 1917 | 1881 | ||
| 1918 | --total_free_strings; | 1882 | --total_free_strings; |
| 1919 | ++total_strings; | 1883 | ++total_strings; |
| @@ -1944,9 +1908,7 @@ allocate_string () | |||
| 1944 | S->data if it was initially non-null. */ | 1908 | S->data if it was initially non-null. */ |
| 1945 | 1909 | ||
| 1946 | void | 1910 | void |
| 1947 | allocate_string_data (s, nchars, nbytes) | 1911 | allocate_string_data (struct Lisp_String *s, int nchars, int nbytes) |
| 1948 | struct Lisp_String *s; | ||
| 1949 | int nchars, nbytes; | ||
| 1950 | { | 1912 | { |
| 1951 | struct sdata *data, *old_data; | 1913 | struct sdata *data, *old_data; |
| 1952 | struct sblock *b; | 1914 | struct sblock *b; |
| @@ -2023,8 +1985,7 @@ allocate_string_data (s, nchars, nbytes) | |||
| 2023 | s->size_byte = nbytes; | 1985 | s->size_byte = nbytes; |
| 2024 | s->data[nbytes] = '\0'; | 1986 | s->data[nbytes] = '\0'; |
| 2025 | #ifdef GC_CHECK_STRING_OVERRUN | 1987 | #ifdef GC_CHECK_STRING_OVERRUN |
| 2026 | bcopy (string_overrun_cookie, (char *) data + needed, | 1988 | memcpy (data + needed, string_overrun_cookie, GC_STRING_OVERRUN_COOKIE_SIZE); |
| 2027 | GC_STRING_OVERRUN_COOKIE_SIZE); | ||
| 2028 | #endif | 1989 | #endif |
| 2029 | 1990 | ||
| 2030 | /* If S had already data assigned, mark that as free by setting its | 1991 | /* If S had already data assigned, mark that as free by setting its |
| @@ -2043,7 +2004,7 @@ allocate_string_data (s, nchars, nbytes) | |||
| 2043 | /* Sweep and compact strings. */ | 2004 | /* Sweep and compact strings. */ |
| 2044 | 2005 | ||
| 2045 | static void | 2006 | static void |
| 2046 | sweep_strings () | 2007 | sweep_strings (void) |
| 2047 | { | 2008 | { |
| 2048 | struct string_block *b, *next; | 2009 | struct string_block *b, *next; |
| 2049 | struct string_block *live_blocks = NULL; | 2010 | struct string_block *live_blocks = NULL; |
| @@ -2143,7 +2104,7 @@ sweep_strings () | |||
| 2143 | /* Free dead large strings. */ | 2104 | /* Free dead large strings. */ |
| 2144 | 2105 | ||
| 2145 | static void | 2106 | static void |
| 2146 | free_large_strings () | 2107 | free_large_strings (void) |
| 2147 | { | 2108 | { |
| 2148 | struct sblock *b, *next; | 2109 | struct sblock *b, *next; |
| 2149 | struct sblock *live_blocks = NULL; | 2110 | struct sblock *live_blocks = NULL; |
| @@ -2169,7 +2130,7 @@ free_large_strings () | |||
| 2169 | data of live strings after compaction. */ | 2130 | data of live strings after compaction. */ |
| 2170 | 2131 | ||
| 2171 | static void | 2132 | static void |
| 2172 | compact_small_strings () | 2133 | compact_small_strings (void) |
| 2173 | { | 2134 | { |
| 2174 | struct sblock *b, *tb, *next; | 2135 | struct sblock *b, *tb, *next; |
| 2175 | struct sdata *from, *to, *end, *tb_end; | 2136 | struct sdata *from, *to, *end, *tb_end; |
| @@ -2215,9 +2176,9 @@ compact_small_strings () | |||
| 2215 | from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); | 2176 | from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); |
| 2216 | 2177 | ||
| 2217 | #ifdef GC_CHECK_STRING_OVERRUN | 2178 | #ifdef GC_CHECK_STRING_OVERRUN |
| 2218 | if (bcmp (string_overrun_cookie, | 2179 | if (memcmp (string_overrun_cookie, |
| 2219 | ((char *) from_end) - GC_STRING_OVERRUN_COOKIE_SIZE, | 2180 | (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE, |
| 2220 | GC_STRING_OVERRUN_COOKIE_SIZE)) | 2181 | GC_STRING_OVERRUN_COOKIE_SIZE)) |
| 2221 | abort (); | 2182 | abort (); |
| 2222 | #endif | 2183 | #endif |
| 2223 | 2184 | ||
| @@ -2239,7 +2200,7 @@ compact_small_strings () | |||
| 2239 | if (from != to) | 2200 | if (from != to) |
| 2240 | { | 2201 | { |
| 2241 | xassert (tb != b || to <= from); | 2202 | xassert (tb != b || to <= from); |
| 2242 | safe_bcopy ((char *) from, (char *) to, nbytes + GC_STRING_EXTRA); | 2203 | memmove (to, from, nbytes + GC_STRING_EXTRA); |
| 2243 | to->string->data = SDATA_DATA (to); | 2204 | to->string->data = SDATA_DATA (to); |
| 2244 | } | 2205 | } |
| 2245 | 2206 | ||
| @@ -2267,8 +2228,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. | 2228 | doc: /* Return a newly created string of length LENGTH, with INIT in each element. |
| 2268 | LENGTH must be an integer. | 2229 | LENGTH must be an integer. |
| 2269 | INIT must be an integer that represents a character. */) | 2230 | INIT must be an integer that represents a character. */) |
| 2270 | (length, init) | 2231 | (Lisp_Object length, Lisp_Object init) |
| 2271 | Lisp_Object length, init; | ||
| 2272 | { | 2232 | { |
| 2273 | register Lisp_Object val; | 2233 | register Lisp_Object val; |
| 2274 | register unsigned char *p, *end; | 2234 | register unsigned char *p, *end; |
| @@ -2298,7 +2258,7 @@ INIT must be an integer that represents a character. */) | |||
| 2298 | end = p + nbytes; | 2258 | end = p + nbytes; |
| 2299 | while (p != end) | 2259 | while (p != end) |
| 2300 | { | 2260 | { |
| 2301 | bcopy (str, p, len); | 2261 | memcpy (p, str, len); |
| 2302 | p += len; | 2262 | p += len; |
| 2303 | } | 2263 | } |
| 2304 | } | 2264 | } |
| @@ -2311,8 +2271,7 @@ INIT must be an integer that represents a character. */) | |||
| 2311 | DEFUN ("make-bool-vector", Fmake_bool_vector, Smake_bool_vector, 2, 2, 0, | 2271 | 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. | 2272 | 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. */) | 2273 | LENGTH must be a number. INIT matters only in whether it is t or nil. */) |
| 2314 | (length, init) | 2274 | (Lisp_Object length, Lisp_Object init) |
| 2315 | Lisp_Object length, init; | ||
| 2316 | { | 2275 | { |
| 2317 | register Lisp_Object val; | 2276 | register Lisp_Object val; |
| 2318 | struct Lisp_Bool_Vector *p; | 2277 | struct Lisp_Bool_Vector *p; |
| @@ -2357,9 +2316,7 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 2357 | multibyte, depending on the contents. */ | 2316 | multibyte, depending on the contents. */ |
| 2358 | 2317 | ||
| 2359 | Lisp_Object | 2318 | Lisp_Object |
| 2360 | make_string (contents, nbytes) | 2319 | make_string (const char *contents, int nbytes) |
| 2361 | const char *contents; | ||
| 2362 | int nbytes; | ||
| 2363 | { | 2320 | { |
| 2364 | register Lisp_Object val; | 2321 | register Lisp_Object val; |
| 2365 | int nchars, multibyte_nbytes; | 2322 | int nchars, multibyte_nbytes; |
| @@ -2378,13 +2335,11 @@ make_string (contents, nbytes) | |||
| 2378 | /* Make an unibyte string from LENGTH bytes at CONTENTS. */ | 2335 | /* Make an unibyte string from LENGTH bytes at CONTENTS. */ |
| 2379 | 2336 | ||
| 2380 | Lisp_Object | 2337 | Lisp_Object |
| 2381 | make_unibyte_string (contents, length) | 2338 | make_unibyte_string (const char *contents, int length) |
| 2382 | const char *contents; | ||
| 2383 | int length; | ||
| 2384 | { | 2339 | { |
| 2385 | register Lisp_Object val; | 2340 | register Lisp_Object val; |
| 2386 | val = make_uninit_string (length); | 2341 | val = make_uninit_string (length); |
| 2387 | bcopy (contents, SDATA (val), length); | 2342 | memcpy (SDATA (val), contents, length); |
| 2388 | STRING_SET_UNIBYTE (val); | 2343 | STRING_SET_UNIBYTE (val); |
| 2389 | return val; | 2344 | return val; |
| 2390 | } | 2345 | } |
| @@ -2394,13 +2349,11 @@ make_unibyte_string (contents, length) | |||
| 2394 | bytes at CONTENTS. */ | 2349 | bytes at CONTENTS. */ |
| 2395 | 2350 | ||
| 2396 | Lisp_Object | 2351 | Lisp_Object |
| 2397 | make_multibyte_string (contents, nchars, nbytes) | 2352 | make_multibyte_string (const char *contents, int nchars, int nbytes) |
| 2398 | const char *contents; | ||
| 2399 | int nchars, nbytes; | ||
| 2400 | { | 2353 | { |
| 2401 | register Lisp_Object val; | 2354 | register Lisp_Object val; |
| 2402 | val = make_uninit_multibyte_string (nchars, nbytes); | 2355 | val = make_uninit_multibyte_string (nchars, nbytes); |
| 2403 | bcopy (contents, SDATA (val), nbytes); | 2356 | memcpy (SDATA (val), contents, nbytes); |
| 2404 | return val; | 2357 | return val; |
| 2405 | } | 2358 | } |
| 2406 | 2359 | ||
| @@ -2409,13 +2362,11 @@ make_multibyte_string (contents, nchars, nbytes) | |||
| 2409 | CONTENTS. It is a multibyte string if NBYTES != NCHARS. */ | 2362 | CONTENTS. It is a multibyte string if NBYTES != NCHARS. */ |
| 2410 | 2363 | ||
| 2411 | Lisp_Object | 2364 | Lisp_Object |
| 2412 | make_string_from_bytes (contents, nchars, nbytes) | 2365 | make_string_from_bytes (const char *contents, int nchars, int nbytes) |
| 2413 | const char *contents; | ||
| 2414 | int nchars, nbytes; | ||
| 2415 | { | 2366 | { |
| 2416 | register Lisp_Object val; | 2367 | register Lisp_Object val; |
| 2417 | val = make_uninit_multibyte_string (nchars, nbytes); | 2368 | val = make_uninit_multibyte_string (nchars, nbytes); |
| 2418 | bcopy (contents, SDATA (val), nbytes); | 2369 | memcpy (SDATA (val), contents, nbytes); |
| 2419 | if (SBYTES (val) == SCHARS (val)) | 2370 | if (SBYTES (val) == SCHARS (val)) |
| 2420 | STRING_SET_UNIBYTE (val); | 2371 | STRING_SET_UNIBYTE (val); |
| 2421 | return val; | 2372 | return val; |
| @@ -2428,10 +2379,7 @@ make_string_from_bytes (contents, nchars, nbytes) | |||
| 2428 | characters by itself. */ | 2379 | characters by itself. */ |
| 2429 | 2380 | ||
| 2430 | Lisp_Object | 2381 | Lisp_Object |
| 2431 | make_specified_string (contents, nchars, nbytes, multibyte) | 2382 | make_specified_string (const char *contents, int nchars, int nbytes, int multibyte) |
| 2432 | const char *contents; | ||
| 2433 | int nchars, nbytes; | ||
| 2434 | int multibyte; | ||
| 2435 | { | 2383 | { |
| 2436 | register Lisp_Object val; | 2384 | register Lisp_Object val; |
| 2437 | 2385 | ||
| @@ -2443,7 +2391,7 @@ make_specified_string (contents, nchars, nbytes, multibyte) | |||
| 2443 | nchars = nbytes; | 2391 | nchars = nbytes; |
| 2444 | } | 2392 | } |
| 2445 | val = make_uninit_multibyte_string (nchars, nbytes); | 2393 | val = make_uninit_multibyte_string (nchars, nbytes); |
| 2446 | bcopy (contents, SDATA (val), nbytes); | 2394 | memcpy (SDATA (val), contents, nbytes); |
| 2447 | if (!multibyte) | 2395 | if (!multibyte) |
| 2448 | STRING_SET_UNIBYTE (val); | 2396 | STRING_SET_UNIBYTE (val); |
| 2449 | return val; | 2397 | return val; |
| @@ -2454,8 +2402,7 @@ make_specified_string (contents, nchars, nbytes, multibyte) | |||
| 2454 | data warrants. */ | 2402 | data warrants. */ |
| 2455 | 2403 | ||
| 2456 | Lisp_Object | 2404 | Lisp_Object |
| 2457 | build_string (str) | 2405 | build_string (const char *str) |
| 2458 | const char *str; | ||
| 2459 | { | 2406 | { |
| 2460 | return make_string (str, strlen (str)); | 2407 | return make_string (str, strlen (str)); |
| 2461 | } | 2408 | } |
| @@ -2465,8 +2412,7 @@ build_string (str) | |||
| 2465 | occupying LENGTH bytes. */ | 2412 | occupying LENGTH bytes. */ |
| 2466 | 2413 | ||
| 2467 | Lisp_Object | 2414 | Lisp_Object |
| 2468 | make_uninit_string (length) | 2415 | make_uninit_string (int length) |
| 2469 | int length; | ||
| 2470 | { | 2416 | { |
| 2471 | Lisp_Object val; | 2417 | Lisp_Object val; |
| 2472 | 2418 | ||
| @@ -2482,8 +2428,7 @@ make_uninit_string (length) | |||
| 2482 | which occupy NBYTES bytes. */ | 2428 | which occupy NBYTES bytes. */ |
| 2483 | 2429 | ||
| 2484 | Lisp_Object | 2430 | Lisp_Object |
| 2485 | make_uninit_multibyte_string (nchars, nbytes) | 2431 | make_uninit_multibyte_string (int nchars, int nbytes) |
| 2486 | int nchars, nbytes; | ||
| 2487 | { | 2432 | { |
| 2488 | Lisp_Object string; | 2433 | Lisp_Object string; |
| 2489 | struct Lisp_String *s; | 2434 | struct Lisp_String *s; |
| @@ -2573,7 +2518,7 @@ struct Lisp_Float *float_free_list; | |||
| 2573 | /* Initialize float allocation. */ | 2518 | /* Initialize float allocation. */ |
| 2574 | 2519 | ||
| 2575 | static void | 2520 | static void |
| 2576 | init_float () | 2521 | init_float (void) |
| 2577 | { | 2522 | { |
| 2578 | float_block = NULL; | 2523 | float_block = NULL; |
| 2579 | float_block_index = FLOAT_BLOCK_SIZE; /* Force alloc of new float_block. */ | 2524 | float_block_index = FLOAT_BLOCK_SIZE; /* Force alloc of new float_block. */ |
| @@ -2582,22 +2527,10 @@ init_float () | |||
| 2582 | } | 2527 | } |
| 2583 | 2528 | ||
| 2584 | 2529 | ||
| 2585 | /* Explicitly free a float cell by putting it on the free-list. */ | ||
| 2586 | |||
| 2587 | static void | ||
| 2588 | free_float (ptr) | ||
| 2589 | struct Lisp_Float *ptr; | ||
| 2590 | { | ||
| 2591 | ptr->u.chain = float_free_list; | ||
| 2592 | float_free_list = ptr; | ||
| 2593 | } | ||
| 2594 | |||
| 2595 | |||
| 2596 | /* Return a new float object with value FLOAT_VALUE. */ | 2530 | /* Return a new float object with value FLOAT_VALUE. */ |
| 2597 | 2531 | ||
| 2598 | Lisp_Object | 2532 | Lisp_Object |
| 2599 | make_float (float_value) | 2533 | make_float (double float_value) |
| 2600 | double float_value; | ||
| 2601 | { | 2534 | { |
| 2602 | register Lisp_Object val; | 2535 | register Lisp_Object val; |
| 2603 | 2536 | ||
| @@ -2621,7 +2554,7 @@ make_float (float_value) | |||
| 2621 | new = (struct float_block *) lisp_align_malloc (sizeof *new, | 2554 | new = (struct float_block *) lisp_align_malloc (sizeof *new, |
| 2622 | MEM_TYPE_FLOAT); | 2555 | MEM_TYPE_FLOAT); |
| 2623 | new->next = float_block; | 2556 | new->next = float_block; |
| 2624 | bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); | 2557 | memset (new->gcmarkbits, 0, sizeof new->gcmarkbits); |
| 2625 | float_block = new; | 2558 | float_block = new; |
| 2626 | float_block_index = 0; | 2559 | float_block_index = 0; |
| 2627 | n_float_blocks++; | 2560 | n_float_blocks++; |
| @@ -2697,7 +2630,7 @@ static int n_cons_blocks; | |||
| 2697 | /* Initialize cons allocation. */ | 2630 | /* Initialize cons allocation. */ |
| 2698 | 2631 | ||
| 2699 | static void | 2632 | static void |
| 2700 | init_cons () | 2633 | init_cons (void) |
| 2701 | { | 2634 | { |
| 2702 | cons_block = NULL; | 2635 | cons_block = NULL; |
| 2703 | cons_block_index = CONS_BLOCK_SIZE; /* Force alloc of new cons_block. */ | 2636 | cons_block_index = CONS_BLOCK_SIZE; /* Force alloc of new cons_block. */ |
| @@ -2709,8 +2642,7 @@ init_cons () | |||
| 2709 | /* Explicitly free a cons cell by putting it on the free-list. */ | 2642 | /* Explicitly free a cons cell by putting it on the free-list. */ |
| 2710 | 2643 | ||
| 2711 | void | 2644 | void |
| 2712 | free_cons (ptr) | 2645 | free_cons (struct Lisp_Cons *ptr) |
| 2713 | struct Lisp_Cons *ptr; | ||
| 2714 | { | 2646 | { |
| 2715 | ptr->u.chain = cons_free_list; | 2647 | ptr->u.chain = cons_free_list; |
| 2716 | #if GC_MARK_STACK | 2648 | #if GC_MARK_STACK |
| @@ -2721,8 +2653,7 @@ free_cons (ptr) | |||
| 2721 | 2653 | ||
| 2722 | DEFUN ("cons", Fcons, Scons, 2, 2, 0, | 2654 | DEFUN ("cons", Fcons, Scons, 2, 2, 0, |
| 2723 | doc: /* Create a new cons, give it CAR and CDR as components, and return it. */) | 2655 | doc: /* Create a new cons, give it CAR and CDR as components, and return it. */) |
| 2724 | (car, cdr) | 2656 | (Lisp_Object car, Lisp_Object cdr) |
| 2725 | Lisp_Object car, cdr; | ||
| 2726 | { | 2657 | { |
| 2727 | register Lisp_Object val; | 2658 | register Lisp_Object val; |
| 2728 | 2659 | ||
| @@ -2744,7 +2675,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 2744 | register struct cons_block *new; | 2675 | register struct cons_block *new; |
| 2745 | new = (struct cons_block *) lisp_align_malloc (sizeof *new, | 2676 | new = (struct cons_block *) lisp_align_malloc (sizeof *new, |
| 2746 | MEM_TYPE_CONS); | 2677 | MEM_TYPE_CONS); |
| 2747 | bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); | 2678 | memset (new->gcmarkbits, 0, sizeof new->gcmarkbits); |
| 2748 | new->next = cons_block; | 2679 | new->next = cons_block; |
| 2749 | cons_block = new; | 2680 | cons_block = new; |
| 2750 | cons_block_index = 0; | 2681 | cons_block_index = 0; |
| @@ -2766,7 +2697,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 2766 | 2697 | ||
| 2767 | /* Get an error now if there's any junk in the cons free list. */ | 2698 | /* Get an error now if there's any junk in the cons free list. */ |
| 2768 | void | 2699 | void |
| 2769 | check_cons_list () | 2700 | check_cons_list (void) |
| 2770 | { | 2701 | { |
| 2771 | #ifdef GC_CHECK_CONS_LIST | 2702 | #ifdef GC_CHECK_CONS_LIST |
| 2772 | struct Lisp_Cons *tail = cons_free_list; | 2703 | struct Lisp_Cons *tail = cons_free_list; |
| @@ -2779,39 +2710,34 @@ check_cons_list () | |||
| 2779 | /* Make a list of 1, 2, 3, 4 or 5 specified objects. */ | 2710 | /* Make a list of 1, 2, 3, 4 or 5 specified objects. */ |
| 2780 | 2711 | ||
| 2781 | Lisp_Object | 2712 | Lisp_Object |
| 2782 | list1 (arg1) | 2713 | list1 (Lisp_Object arg1) |
| 2783 | Lisp_Object arg1; | ||
| 2784 | { | 2714 | { |
| 2785 | return Fcons (arg1, Qnil); | 2715 | return Fcons (arg1, Qnil); |
| 2786 | } | 2716 | } |
| 2787 | 2717 | ||
| 2788 | Lisp_Object | 2718 | Lisp_Object |
| 2789 | list2 (arg1, arg2) | 2719 | list2 (Lisp_Object arg1, Lisp_Object arg2) |
| 2790 | Lisp_Object arg1, arg2; | ||
| 2791 | { | 2720 | { |
| 2792 | return Fcons (arg1, Fcons (arg2, Qnil)); | 2721 | return Fcons (arg1, Fcons (arg2, Qnil)); |
| 2793 | } | 2722 | } |
| 2794 | 2723 | ||
| 2795 | 2724 | ||
| 2796 | Lisp_Object | 2725 | Lisp_Object |
| 2797 | list3 (arg1, arg2, arg3) | 2726 | list3 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) |
| 2798 | Lisp_Object arg1, arg2, arg3; | ||
| 2799 | { | 2727 | { |
| 2800 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Qnil))); | 2728 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Qnil))); |
| 2801 | } | 2729 | } |
| 2802 | 2730 | ||
| 2803 | 2731 | ||
| 2804 | Lisp_Object | 2732 | Lisp_Object |
| 2805 | list4 (arg1, arg2, arg3, arg4) | 2733 | list4 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4) |
| 2806 | Lisp_Object arg1, arg2, arg3, arg4; | ||
| 2807 | { | 2734 | { |
| 2808 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Qnil)))); | 2735 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Qnil)))); |
| 2809 | } | 2736 | } |
| 2810 | 2737 | ||
| 2811 | 2738 | ||
| 2812 | Lisp_Object | 2739 | Lisp_Object |
| 2813 | list5 (arg1, arg2, arg3, arg4, arg5) | 2740 | 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 | { | 2741 | { |
| 2816 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, | 2742 | return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, |
| 2817 | Fcons (arg5, Qnil))))); | 2743 | Fcons (arg5, Qnil))))); |
| @@ -2822,9 +2748,7 @@ DEFUN ("list", Flist, Slist, 0, MANY, 0, | |||
| 2822 | doc: /* Return a newly created list with specified arguments as elements. | 2748 | doc: /* Return a newly created list with specified arguments as elements. |
| 2823 | Any number of arguments, even zero arguments, are allowed. | 2749 | Any number of arguments, even zero arguments, are allowed. |
| 2824 | usage: (list &rest OBJECTS) */) | 2750 | usage: (list &rest OBJECTS) */) |
| 2825 | (nargs, args) | 2751 | (int nargs, register Lisp_Object *args) |
| 2826 | int nargs; | ||
| 2827 | register Lisp_Object *args; | ||
| 2828 | { | 2752 | { |
| 2829 | register Lisp_Object val; | 2753 | register Lisp_Object val; |
| 2830 | val = Qnil; | 2754 | val = Qnil; |
| @@ -2840,8 +2764,7 @@ usage: (list &rest OBJECTS) */) | |||
| 2840 | 2764 | ||
| 2841 | DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0, | 2765 | 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. */) | 2766 | doc: /* Return a newly created list of length LENGTH, with each element being INIT. */) |
| 2843 | (length, init) | 2767 | (register Lisp_Object length, Lisp_Object init) |
| 2844 | register Lisp_Object length, init; | ||
| 2845 | { | 2768 | { |
| 2846 | register Lisp_Object val; | 2769 | register Lisp_Object val; |
| 2847 | register int size; | 2770 | register int size; |
| @@ -2904,8 +2827,7 @@ static int n_vectors; | |||
| 2904 | with room for LEN Lisp_Objects. */ | 2827 | with room for LEN Lisp_Objects. */ |
| 2905 | 2828 | ||
| 2906 | static struct Lisp_Vector * | 2829 | static struct Lisp_Vector * |
| 2907 | allocate_vectorlike (len) | 2830 | allocate_vectorlike (EMACS_INT len) |
| 2908 | EMACS_INT len; | ||
| 2909 | { | 2831 | { |
| 2910 | struct Lisp_Vector *p; | 2832 | struct Lisp_Vector *p; |
| 2911 | size_t nbytes; | 2833 | size_t nbytes; |
| @@ -2946,8 +2868,7 @@ allocate_vectorlike (len) | |||
| 2946 | /* Allocate a vector with NSLOTS slots. */ | 2868 | /* Allocate a vector with NSLOTS slots. */ |
| 2947 | 2869 | ||
| 2948 | struct Lisp_Vector * | 2870 | struct Lisp_Vector * |
| 2949 | allocate_vector (nslots) | 2871 | allocate_vector (EMACS_INT nslots) |
| 2950 | EMACS_INT nslots; | ||
| 2951 | { | 2872 | { |
| 2952 | struct Lisp_Vector *v = allocate_vectorlike (nslots); | 2873 | struct Lisp_Vector *v = allocate_vectorlike (nslots); |
| 2953 | v->size = nslots; | 2874 | v->size = nslots; |
| @@ -2958,9 +2879,7 @@ allocate_vector (nslots) | |||
| 2958 | /* Allocate other vector-like structures. */ | 2879 | /* Allocate other vector-like structures. */ |
| 2959 | 2880 | ||
| 2960 | struct Lisp_Vector * | 2881 | struct Lisp_Vector * |
| 2961 | allocate_pseudovector (memlen, lisplen, tag) | 2882 | allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag) |
| 2962 | int memlen, lisplen; | ||
| 2963 | EMACS_INT tag; | ||
| 2964 | { | 2883 | { |
| 2965 | struct Lisp_Vector *v = allocate_vectorlike (memlen); | 2884 | struct Lisp_Vector *v = allocate_vectorlike (memlen); |
| 2966 | EMACS_INT i; | 2885 | EMACS_INT i; |
| @@ -2982,38 +2901,38 @@ allocate_hash_table (void) | |||
| 2982 | 2901 | ||
| 2983 | 2902 | ||
| 2984 | struct window * | 2903 | struct window * |
| 2985 | allocate_window () | 2904 | allocate_window (void) |
| 2986 | { | 2905 | { |
| 2987 | return ALLOCATE_PSEUDOVECTOR(struct window, current_matrix, PVEC_WINDOW); | 2906 | return ALLOCATE_PSEUDOVECTOR(struct window, current_matrix, PVEC_WINDOW); |
| 2988 | } | 2907 | } |
| 2989 | 2908 | ||
| 2990 | 2909 | ||
| 2991 | struct terminal * | 2910 | struct terminal * |
| 2992 | allocate_terminal () | 2911 | allocate_terminal (void) |
| 2993 | { | 2912 | { |
| 2994 | struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal, | 2913 | struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal, |
| 2995 | next_terminal, PVEC_TERMINAL); | 2914 | next_terminal, PVEC_TERMINAL); |
| 2996 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ | 2915 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ |
| 2997 | bzero (&(t->next_terminal), | 2916 | memset (&t->next_terminal, 0, |
| 2998 | ((char*)(t+1)) - ((char*)&(t->next_terminal))); | 2917 | (char*) (t + 1) - (char*) &t->next_terminal); |
| 2999 | 2918 | ||
| 3000 | return t; | 2919 | return t; |
| 3001 | } | 2920 | } |
| 3002 | 2921 | ||
| 3003 | struct frame * | 2922 | struct frame * |
| 3004 | allocate_frame () | 2923 | allocate_frame (void) |
| 3005 | { | 2924 | { |
| 3006 | struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame, | 2925 | struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame, |
| 3007 | face_cache, PVEC_FRAME); | 2926 | face_cache, PVEC_FRAME); |
| 3008 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ | 2927 | /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ |
| 3009 | bzero (&(f->face_cache), | 2928 | memset (&f->face_cache, 0, |
| 3010 | ((char*)(f+1)) - ((char*)&(f->face_cache))); | 2929 | (char *) (f + 1) - (char *) &f->face_cache); |
| 3011 | return f; | 2930 | return f; |
| 3012 | } | 2931 | } |
| 3013 | 2932 | ||
| 3014 | 2933 | ||
| 3015 | struct Lisp_Process * | 2934 | struct Lisp_Process * |
| 3016 | allocate_process () | 2935 | allocate_process (void) |
| 3017 | { | 2936 | { |
| 3018 | return ALLOCATE_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS); | 2937 | return ALLOCATE_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS); |
| 3019 | } | 2938 | } |
| @@ -3022,8 +2941,7 @@ allocate_process () | |||
| 3022 | DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0, | 2941 | 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. | 2942 | doc: /* Return a newly created vector of length LENGTH, with each element being INIT. |
| 3024 | See also the function `vector'. */) | 2943 | See also the function `vector'. */) |
| 3025 | (length, init) | 2944 | (register Lisp_Object length, Lisp_Object init) |
| 3026 | register Lisp_Object length, init; | ||
| 3027 | { | 2945 | { |
| 3028 | Lisp_Object vector; | 2946 | Lisp_Object vector; |
| 3029 | register EMACS_INT sizei; | 2947 | register EMACS_INT sizei; |
| @@ -3046,9 +2964,7 @@ DEFUN ("vector", Fvector, Svector, 0, MANY, 0, | |||
| 3046 | doc: /* Return a newly created vector with specified arguments as elements. | 2964 | doc: /* Return a newly created vector with specified arguments as elements. |
| 3047 | Any number of arguments, even zero arguments, are allowed. | 2965 | Any number of arguments, even zero arguments, are allowed. |
| 3048 | usage: (vector &rest OBJECTS) */) | 2966 | usage: (vector &rest OBJECTS) */) |
| 3049 | (nargs, args) | 2967 | (register int nargs, Lisp_Object *args) |
| 3050 | register int nargs; | ||
| 3051 | Lisp_Object *args; | ||
| 3052 | { | 2968 | { |
| 3053 | register Lisp_Object len, val; | 2969 | register Lisp_Object len, val; |
| 3054 | register int index; | 2970 | register int index; |
| @@ -3070,9 +2986,7 @@ stack size, (optional) doc string, and (optional) interactive spec. | |||
| 3070 | The first four arguments are required; at most six have any | 2986 | The first four arguments are required; at most six have any |
| 3071 | significance. | 2987 | significance. |
| 3072 | usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) | 2988 | usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) |
| 3073 | (nargs, args) | 2989 | (register int nargs, Lisp_Object *args) |
| 3074 | register int nargs; | ||
| 3075 | Lisp_Object *args; | ||
| 3076 | { | 2990 | { |
| 3077 | register Lisp_Object len, val; | 2991 | register Lisp_Object len, val; |
| 3078 | register int index; | 2992 | register int index; |
| @@ -3084,7 +2998,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT | |||
| 3084 | else | 2998 | else |
| 3085 | val = Fmake_vector (len, Qnil); | 2999 | val = Fmake_vector (len, Qnil); |
| 3086 | 3000 | ||
| 3087 | if (STRINGP (args[1]) && STRING_MULTIBYTE (args[1])) | 3001 | if (nargs > 1 && STRINGP (args[1]) && STRING_MULTIBYTE (args[1])) |
| 3088 | /* BYTECODE-STRING must have been produced by Emacs 20.2 or the | 3002 | /* BYTECODE-STRING must have been produced by Emacs 20.2 or the |
| 3089 | earlier because they produced a raw 8-bit string for byte-code | 3003 | earlier because they produced a raw 8-bit string for byte-code |
| 3090 | and now such a byte-code string is loaded as multibyte while | 3004 | and now such a byte-code string is loaded as multibyte while |
| @@ -3142,7 +3056,7 @@ static int n_symbol_blocks; | |||
| 3142 | /* Initialize symbol allocation. */ | 3056 | /* Initialize symbol allocation. */ |
| 3143 | 3057 | ||
| 3144 | static void | 3058 | static void |
| 3145 | init_symbol () | 3059 | init_symbol (void) |
| 3146 | { | 3060 | { |
| 3147 | symbol_block = NULL; | 3061 | symbol_block = NULL; |
| 3148 | symbol_block_index = SYMBOL_BLOCK_SIZE; | 3062 | symbol_block_index = SYMBOL_BLOCK_SIZE; |
| @@ -3154,8 +3068,7 @@ init_symbol () | |||
| 3154 | DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, | 3068 | DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, |
| 3155 | doc: /* Return a newly allocated uninterned symbol whose name is NAME. | 3069 | doc: /* Return a newly allocated uninterned symbol whose name is NAME. |
| 3156 | Its value and function definition are void, and its property list is nil. */) | 3070 | Its value and function definition are void, and its property list is nil. */) |
| 3157 | (name) | 3071 | (Lisp_Object name) |
| 3158 | Lisp_Object name; | ||
| 3159 | { | 3072 | { |
| 3160 | register Lisp_Object val; | 3073 | register Lisp_Object val; |
| 3161 | register struct Lisp_Symbol *p; | 3074 | register struct Lisp_Symbol *p; |
| @@ -3233,7 +3146,7 @@ static union Lisp_Misc *marker_free_list; | |||
| 3233 | static int n_marker_blocks; | 3146 | static int n_marker_blocks; |
| 3234 | 3147 | ||
| 3235 | static void | 3148 | static void |
| 3236 | init_marker () | 3149 | init_marker (void) |
| 3237 | { | 3150 | { |
| 3238 | marker_block = NULL; | 3151 | marker_block = NULL; |
| 3239 | marker_block_index = MARKER_BLOCK_SIZE; | 3152 | marker_block_index = MARKER_BLOCK_SIZE; |
| @@ -3244,7 +3157,7 @@ init_marker () | |||
| 3244 | /* Return a newly allocated Lisp_Misc object, with no substructure. */ | 3157 | /* Return a newly allocated Lisp_Misc object, with no substructure. */ |
| 3245 | 3158 | ||
| 3246 | Lisp_Object | 3159 | Lisp_Object |
| 3247 | allocate_misc () | 3160 | allocate_misc (void) |
| 3248 | { | 3161 | { |
| 3249 | Lisp_Object val; | 3162 | Lisp_Object val; |
| 3250 | 3163 | ||
| @@ -3286,8 +3199,7 @@ allocate_misc () | |||
| 3286 | /* Free a Lisp_Misc object */ | 3199 | /* Free a Lisp_Misc object */ |
| 3287 | 3200 | ||
| 3288 | void | 3201 | void |
| 3289 | free_misc (misc) | 3202 | free_misc (Lisp_Object misc) |
| 3290 | Lisp_Object misc; | ||
| 3291 | { | 3203 | { |
| 3292 | XMISCTYPE (misc) = Lisp_Misc_Free; | 3204 | XMISCTYPE (misc) = Lisp_Misc_Free; |
| 3293 | XMISC (misc)->u_free.chain = marker_free_list; | 3205 | XMISC (misc)->u_free.chain = marker_free_list; |
| @@ -3301,9 +3213,7 @@ free_misc (misc) | |||
| 3301 | The unwind function can get the C values back using XSAVE_VALUE. */ | 3213 | The unwind function can get the C values back using XSAVE_VALUE. */ |
| 3302 | 3214 | ||
| 3303 | Lisp_Object | 3215 | Lisp_Object |
| 3304 | make_save_value (pointer, integer) | 3216 | make_save_value (void *pointer, int integer) |
| 3305 | void *pointer; | ||
| 3306 | int integer; | ||
| 3307 | { | 3217 | { |
| 3308 | register Lisp_Object val; | 3218 | register Lisp_Object val; |
| 3309 | register struct Lisp_Save_Value *p; | 3219 | register struct Lisp_Save_Value *p; |
| @@ -3319,7 +3229,7 @@ make_save_value (pointer, integer) | |||
| 3319 | 3229 | ||
| 3320 | DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, | 3230 | DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, |
| 3321 | doc: /* Return a newly allocated marker which does not point at any place. */) | 3231 | doc: /* Return a newly allocated marker which does not point at any place. */) |
| 3322 | () | 3232 | (void) |
| 3323 | { | 3233 | { |
| 3324 | register Lisp_Object val; | 3234 | register Lisp_Object val; |
| 3325 | register struct Lisp_Marker *p; | 3235 | register struct Lisp_Marker *p; |
| @@ -3338,8 +3248,7 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, | |||
| 3338 | /* Put MARKER back on the free list after using it temporarily. */ | 3248 | /* Put MARKER back on the free list after using it temporarily. */ |
| 3339 | 3249 | ||
| 3340 | void | 3250 | void |
| 3341 | free_marker (marker) | 3251 | free_marker (Lisp_Object marker) |
| 3342 | Lisp_Object marker; | ||
| 3343 | { | 3252 | { |
| 3344 | unchain_marker (XMARKER (marker)); | 3253 | unchain_marker (XMARKER (marker)); |
| 3345 | free_misc (marker); | 3254 | free_misc (marker); |
| @@ -3353,9 +3262,7 @@ free_marker (marker) | |||
| 3353 | Any number of arguments, even zero arguments, are allowed. */ | 3262 | Any number of arguments, even zero arguments, are allowed. */ |
| 3354 | 3263 | ||
| 3355 | Lisp_Object | 3264 | Lisp_Object |
| 3356 | make_event_array (nargs, args) | 3265 | make_event_array (register int nargs, Lisp_Object *args) |
| 3357 | register int nargs; | ||
| 3358 | Lisp_Object *args; | ||
| 3359 | { | 3266 | { |
| 3360 | int i; | 3267 | int i; |
| 3361 | 3268 | ||
| @@ -3395,7 +3302,7 @@ make_event_array (nargs, args) | |||
| 3395 | /* Called if malloc returns zero. */ | 3302 | /* Called if malloc returns zero. */ |
| 3396 | 3303 | ||
| 3397 | void | 3304 | void |
| 3398 | memory_full () | 3305 | memory_full (void) |
| 3399 | { | 3306 | { |
| 3400 | int i; | 3307 | int i; |
| 3401 | 3308 | ||
| @@ -3435,7 +3342,7 @@ memory_full () | |||
| 3435 | and also directly from this file, in case we're not using ralloc.c. */ | 3342 | and also directly from this file, in case we're not using ralloc.c. */ |
| 3436 | 3343 | ||
| 3437 | void | 3344 | void |
| 3438 | refill_memory_reserve () | 3345 | refill_memory_reserve (void) |
| 3439 | { | 3346 | { |
| 3440 | #ifndef SYSTEM_MALLOC | 3347 | #ifndef SYSTEM_MALLOC |
| 3441 | if (spare_memory[0] == 0) | 3348 | if (spare_memory[0] == 0) |
| @@ -3483,7 +3390,7 @@ refill_memory_reserve () | |||
| 3483 | /* Initialize this part of alloc.c. */ | 3390 | /* Initialize this part of alloc.c. */ |
| 3484 | 3391 | ||
| 3485 | static void | 3392 | static void |
| 3486 | mem_init () | 3393 | mem_init (void) |
| 3487 | { | 3394 | { |
| 3488 | mem_z.left = mem_z.right = MEM_NIL; | 3395 | mem_z.left = mem_z.right = MEM_NIL; |
| 3489 | mem_z.parent = NULL; | 3396 | mem_z.parent = NULL; |
| @@ -3497,8 +3404,7 @@ mem_init () | |||
| 3497 | MEM_NIL if there is no node in the tree containing START. */ | 3404 | MEM_NIL if there is no node in the tree containing START. */ |
| 3498 | 3405 | ||
| 3499 | static INLINE struct mem_node * | 3406 | static INLINE struct mem_node * |
| 3500 | mem_find (start) | 3407 | mem_find (void *start) |
| 3501 | void *start; | ||
| 3502 | { | 3408 | { |
| 3503 | struct mem_node *p; | 3409 | struct mem_node *p; |
| 3504 | 3410 | ||
| @@ -3521,9 +3427,7 @@ mem_find (start) | |||
| 3521 | pointer to the node that was inserted. */ | 3427 | pointer to the node that was inserted. */ |
| 3522 | 3428 | ||
| 3523 | static struct mem_node * | 3429 | static struct mem_node * |
| 3524 | mem_insert (start, end, type) | 3430 | mem_insert (void *start, void *end, enum mem_type type) |
| 3525 | void *start, *end; | ||
| 3526 | enum mem_type type; | ||
| 3527 | { | 3431 | { |
| 3528 | struct mem_node *c, *parent, *x; | 3432 | struct mem_node *c, *parent, *x; |
| 3529 | 3433 | ||
| @@ -3595,8 +3499,7 @@ mem_insert (start, end, type) | |||
| 3595 | balance the tree, after node X has been inserted; X is always red. */ | 3499 | balance the tree, after node X has been inserted; X is always red. */ |
| 3596 | 3500 | ||
| 3597 | static void | 3501 | static void |
| 3598 | mem_insert_fixup (x) | 3502 | mem_insert_fixup (struct mem_node *x) |
| 3599 | struct mem_node *x; | ||
| 3600 | { | 3503 | { |
| 3601 | while (x != mem_root && x->parent->color == MEM_RED) | 3504 | while (x != mem_root && x->parent->color == MEM_RED) |
| 3602 | { | 3505 | { |
| @@ -3674,8 +3577,7 @@ mem_insert_fixup (x) | |||
| 3674 | b c a b */ | 3577 | b c a b */ |
| 3675 | 3578 | ||
| 3676 | static void | 3579 | static void |
| 3677 | mem_rotate_left (x) | 3580 | mem_rotate_left (struct mem_node *x) |
| 3678 | struct mem_node *x; | ||
| 3679 | { | 3581 | { |
| 3680 | struct mem_node *y; | 3582 | struct mem_node *y; |
| 3681 | 3583 | ||
| @@ -3714,8 +3616,7 @@ mem_rotate_left (x) | |||
| 3714 | a b b c */ | 3616 | a b b c */ |
| 3715 | 3617 | ||
| 3716 | static void | 3618 | static void |
| 3717 | mem_rotate_right (x) | 3619 | mem_rotate_right (struct mem_node *x) |
| 3718 | struct mem_node *x; | ||
| 3719 | { | 3620 | { |
| 3720 | struct mem_node *y = x->left; | 3621 | struct mem_node *y = x->left; |
| 3721 | 3622 | ||
| @@ -3744,8 +3645,7 @@ mem_rotate_right (x) | |||
| 3744 | /* Delete node Z from the tree. If Z is null or MEM_NIL, do nothing. */ | 3645 | /* Delete node Z from the tree. If Z is null or MEM_NIL, do nothing. */ |
| 3745 | 3646 | ||
| 3746 | static void | 3647 | static void |
| 3747 | mem_delete (z) | 3648 | mem_delete (struct mem_node *z) |
| 3748 | struct mem_node *z; | ||
| 3749 | { | 3649 | { |
| 3750 | struct mem_node *x, *y; | 3650 | struct mem_node *x, *y; |
| 3751 | 3651 | ||
| @@ -3799,8 +3699,7 @@ mem_delete (z) | |||
| 3799 | deletion. */ | 3699 | deletion. */ |
| 3800 | 3700 | ||
| 3801 | static void | 3701 | static void |
| 3802 | mem_delete_fixup (x) | 3702 | mem_delete_fixup (struct mem_node *x) |
| 3803 | struct mem_node *x; | ||
| 3804 | { | 3703 | { |
| 3805 | while (x != mem_root && x->color == MEM_BLACK) | 3704 | while (x != mem_root && x->color == MEM_BLACK) |
| 3806 | { | 3705 | { |
| @@ -3881,9 +3780,7 @@ mem_delete_fixup (x) | |||
| 3881 | the heap. M is a pointer to the mem_block for P. */ | 3780 | the heap. M is a pointer to the mem_block for P. */ |
| 3882 | 3781 | ||
| 3883 | static INLINE int | 3782 | static INLINE int |
| 3884 | live_string_p (m, p) | 3783 | live_string_p (struct mem_node *m, void *p) |
| 3885 | struct mem_node *m; | ||
| 3886 | void *p; | ||
| 3887 | { | 3784 | { |
| 3888 | if (m->type == MEM_TYPE_STRING) | 3785 | if (m->type == MEM_TYPE_STRING) |
| 3889 | { | 3786 | { |
| @@ -3906,9 +3803,7 @@ live_string_p (m, p) | |||
| 3906 | the heap. M is a pointer to the mem_block for P. */ | 3803 | the heap. M is a pointer to the mem_block for P. */ |
| 3907 | 3804 | ||
| 3908 | static INLINE int | 3805 | static INLINE int |
| 3909 | live_cons_p (m, p) | 3806 | live_cons_p (struct mem_node *m, void *p) |
| 3910 | struct mem_node *m; | ||
| 3911 | void *p; | ||
| 3912 | { | 3807 | { |
| 3913 | if (m->type == MEM_TYPE_CONS) | 3808 | if (m->type == MEM_TYPE_CONS) |
| 3914 | { | 3809 | { |
| @@ -3934,9 +3829,7 @@ live_cons_p (m, p) | |||
| 3934 | the heap. M is a pointer to the mem_block for P. */ | 3829 | the heap. M is a pointer to the mem_block for P. */ |
| 3935 | 3830 | ||
| 3936 | static INLINE int | 3831 | static INLINE int |
| 3937 | live_symbol_p (m, p) | 3832 | live_symbol_p (struct mem_node *m, void *p) |
| 3938 | struct mem_node *m; | ||
| 3939 | void *p; | ||
| 3940 | { | 3833 | { |
| 3941 | if (m->type == MEM_TYPE_SYMBOL) | 3834 | if (m->type == MEM_TYPE_SYMBOL) |
| 3942 | { | 3835 | { |
| @@ -3962,9 +3855,7 @@ live_symbol_p (m, p) | |||
| 3962 | the heap. M is a pointer to the mem_block for P. */ | 3855 | the heap. M is a pointer to the mem_block for P. */ |
| 3963 | 3856 | ||
| 3964 | static INLINE int | 3857 | static INLINE int |
| 3965 | live_float_p (m, p) | 3858 | live_float_p (struct mem_node *m, void *p) |
| 3966 | struct mem_node *m; | ||
| 3967 | void *p; | ||
| 3968 | { | 3859 | { |
| 3969 | if (m->type == MEM_TYPE_FLOAT) | 3860 | if (m->type == MEM_TYPE_FLOAT) |
| 3970 | { | 3861 | { |
| @@ -3988,9 +3879,7 @@ live_float_p (m, p) | |||
| 3988 | the heap. M is a pointer to the mem_block for P. */ | 3879 | the heap. M is a pointer to the mem_block for P. */ |
| 3989 | 3880 | ||
| 3990 | static INLINE int | 3881 | static INLINE int |
| 3991 | live_misc_p (m, p) | 3882 | live_misc_p (struct mem_node *m, void *p) |
| 3992 | struct mem_node *m; | ||
| 3993 | void *p; | ||
| 3994 | { | 3883 | { |
| 3995 | if (m->type == MEM_TYPE_MISC) | 3884 | if (m->type == MEM_TYPE_MISC) |
| 3996 | { | 3885 | { |
| @@ -4016,9 +3905,7 @@ live_misc_p (m, p) | |||
| 4016 | M is a pointer to the mem_block for P. */ | 3905 | M is a pointer to the mem_block for P. */ |
| 4017 | 3906 | ||
| 4018 | static INLINE int | 3907 | static INLINE int |
| 4019 | live_vector_p (m, p) | 3908 | live_vector_p (struct mem_node *m, void *p) |
| 4020 | struct mem_node *m; | ||
| 4021 | void *p; | ||
| 4022 | { | 3909 | { |
| 4023 | return (p == m->start && m->type == MEM_TYPE_VECTORLIKE); | 3910 | return (p == m->start && m->type == MEM_TYPE_VECTORLIKE); |
| 4024 | } | 3911 | } |
| @@ -4028,9 +3915,7 @@ live_vector_p (m, p) | |||
| 4028 | pointer to the mem_block for P. */ | 3915 | pointer to the mem_block for P. */ |
| 4029 | 3916 | ||
| 4030 | static INLINE int | 3917 | static INLINE int |
| 4031 | live_buffer_p (m, p) | 3918 | live_buffer_p (struct mem_node *m, void *p) |
| 4032 | struct mem_node *m; | ||
| 4033 | void *p; | ||
| 4034 | { | 3919 | { |
| 4035 | /* P must point to the start of the block, and the buffer | 3920 | /* P must point to the start of the block, and the buffer |
| 4036 | must not have been killed. */ | 3921 | must not have been killed. */ |
| @@ -4073,7 +3958,7 @@ static double avg_live; | |||
| 4073 | 3958 | ||
| 4074 | DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", | 3959 | DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", |
| 4075 | doc: /* Show information about live and zombie objects. */) | 3960 | doc: /* Show information about live and zombie objects. */) |
| 4076 | () | 3961 | (void) |
| 4077 | { | 3962 | { |
| 4078 | Lisp_Object args[8], zombie_list = Qnil; | 3963 | Lisp_Object args[8], zombie_list = Qnil; |
| 4079 | int i; | 3964 | int i; |
| @@ -4096,8 +3981,7 @@ DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", | |||
| 4096 | /* Mark OBJ if we can prove it's a Lisp_Object. */ | 3981 | /* Mark OBJ if we can prove it's a Lisp_Object. */ |
| 4097 | 3982 | ||
| 4098 | static INLINE void | 3983 | static INLINE void |
| 4099 | mark_maybe_object (obj) | 3984 | mark_maybe_object (Lisp_Object obj) |
| 4100 | Lisp_Object obj; | ||
| 4101 | { | 3985 | { |
| 4102 | void *po = (void *) XPNTR (obj); | 3986 | void *po = (void *) XPNTR (obj); |
| 4103 | struct mem_node *m = mem_find (po); | 3987 | struct mem_node *m = mem_find (po); |
| @@ -4160,8 +4044,7 @@ mark_maybe_object (obj) | |||
| 4160 | marked. */ | 4044 | marked. */ |
| 4161 | 4045 | ||
| 4162 | static INLINE void | 4046 | static INLINE void |
| 4163 | mark_maybe_pointer (p) | 4047 | mark_maybe_pointer (void *p) |
| 4164 | void *p; | ||
| 4165 | { | 4048 | { |
| 4166 | struct mem_node *m; | 4049 | struct mem_node *m; |
| 4167 | 4050 | ||
| @@ -4241,9 +4124,7 @@ mark_maybe_pointer (p) | |||
| 4241 | or END+OFFSET..START. */ | 4124 | or END+OFFSET..START. */ |
| 4242 | 4125 | ||
| 4243 | static void | 4126 | static void |
| 4244 | mark_memory (start, end, offset) | 4127 | mark_memory (void *start, void *end, int offset) |
| 4245 | void *start, *end; | ||
| 4246 | int offset; | ||
| 4247 | { | 4128 | { |
| 4248 | Lisp_Object *p; | 4129 | Lisp_Object *p; |
| 4249 | void **pp; | 4130 | void **pp; |
| @@ -4459,7 +4340,7 @@ dump_zombies () | |||
| 4459 | equally on the stack. */ | 4340 | equally on the stack. */ |
| 4460 | 4341 | ||
| 4461 | static void | 4342 | static void |
| 4462 | mark_stack () | 4343 | mark_stack (void) |
| 4463 | { | 4344 | { |
| 4464 | int i; | 4345 | int i; |
| 4465 | /* jmp_buf may not be aligned enough on darwin-ppc64 */ | 4346 | /* jmp_buf may not be aligned enough on darwin-ppc64 */ |
| @@ -4534,8 +4415,7 @@ mark_stack () | |||
| 4534 | 4415 | ||
| 4535 | /* Determine whether it is safe to access memory at address P. */ | 4416 | /* Determine whether it is safe to access memory at address P. */ |
| 4536 | static int | 4417 | static int |
| 4537 | valid_pointer_p (p) | 4418 | valid_pointer_p (void *p) |
| 4538 | void *p; | ||
| 4539 | { | 4419 | { |
| 4540 | #ifdef WINDOWSNT | 4420 | #ifdef WINDOWSNT |
| 4541 | return w32_valid_pointer_p (p, 16); | 4421 | return w32_valid_pointer_p (p, 16); |
| @@ -4566,8 +4446,7 @@ valid_pointer_p (p) | |||
| 4566 | so it should only be used in code for manual debugging. */ | 4446 | so it should only be used in code for manual debugging. */ |
| 4567 | 4447 | ||
| 4568 | int | 4448 | int |
| 4569 | valid_lisp_object_p (obj) | 4449 | valid_lisp_object_p (Lisp_Object obj) |
| 4570 | Lisp_Object obj; | ||
| 4571 | { | 4450 | { |
| 4572 | void *p; | 4451 | void *p; |
| 4573 | #if GC_MARK_STACK | 4452 | #if GC_MARK_STACK |
| @@ -4645,9 +4524,7 @@ valid_lisp_object_p (obj) | |||
| 4645 | allocated. TYPE < 0 means it's not used for a Lisp object. */ | 4524 | allocated. TYPE < 0 means it's not used for a Lisp object. */ |
| 4646 | 4525 | ||
| 4647 | static POINTER_TYPE * | 4526 | static POINTER_TYPE * |
| 4648 | pure_alloc (size, type) | 4527 | pure_alloc (size_t size, int type) |
| 4649 | size_t size; | ||
| 4650 | int type; | ||
| 4651 | { | 4528 | { |
| 4652 | POINTER_TYPE *result; | 4529 | POINTER_TYPE *result; |
| 4653 | #ifdef USE_LSB_TAG | 4530 | #ifdef USE_LSB_TAG |
| @@ -4701,7 +4578,7 @@ pure_alloc (size, type) | |||
| 4701 | /* Print a warning if PURESIZE is too small. */ | 4578 | /* Print a warning if PURESIZE is too small. */ |
| 4702 | 4579 | ||
| 4703 | void | 4580 | void |
| 4704 | check_pure_size () | 4581 | check_pure_size (void) |
| 4705 | { | 4582 | { |
| 4706 | if (pure_bytes_used_before_overflow) | 4583 | if (pure_bytes_used_before_overflow) |
| 4707 | message ("emacs:0:Pure Lisp storage overflow (approx. %d bytes needed)", | 4584 | message ("emacs:0:Pure Lisp storage overflow (approx. %d bytes needed)", |
| @@ -4714,9 +4591,7 @@ check_pure_size () | |||
| 4714 | address. Return NULL if not found. */ | 4591 | address. Return NULL if not found. */ |
| 4715 | 4592 | ||
| 4716 | static char * | 4593 | static char * |
| 4717 | find_string_data_in_pure (data, nbytes) | 4594 | find_string_data_in_pure (const char *data, int nbytes) |
| 4718 | const char *data; | ||
| 4719 | int nbytes; | ||
| 4720 | { | 4595 | { |
| 4721 | int i, skip, bm_skip[256], last_char_skip, infinity, start, start_max; | 4596 | int i, skip, bm_skip[256], last_char_skip, infinity, start, start_max; |
| 4722 | const unsigned char *p; | 4597 | const unsigned char *p; |
| @@ -4785,10 +4660,7 @@ find_string_data_in_pure (data, nbytes) | |||
| 4785 | string; then the string is not protected from gc. */ | 4660 | string; then the string is not protected from gc. */ |
| 4786 | 4661 | ||
| 4787 | Lisp_Object | 4662 | Lisp_Object |
| 4788 | make_pure_string (data, nchars, nbytes, multibyte) | 4663 | make_pure_string (const char *data, int nchars, int nbytes, int multibyte) |
| 4789 | const char *data; | ||
| 4790 | int nchars, nbytes; | ||
| 4791 | int multibyte; | ||
| 4792 | { | 4664 | { |
| 4793 | Lisp_Object string; | 4665 | Lisp_Object string; |
| 4794 | struct Lisp_String *s; | 4666 | struct Lisp_String *s; |
| @@ -4798,7 +4670,7 @@ make_pure_string (data, nchars, nbytes, multibyte) | |||
| 4798 | if (s->data == NULL) | 4670 | if (s->data == NULL) |
| 4799 | { | 4671 | { |
| 4800 | s->data = (unsigned char *) pure_alloc (nbytes + 1, -1); | 4672 | s->data = (unsigned char *) pure_alloc (nbytes + 1, -1); |
| 4801 | bcopy (data, s->data, nbytes); | 4673 | memcpy (s->data, data, nbytes); |
| 4802 | s->data[nbytes] = '\0'; | 4674 | s->data[nbytes] = '\0'; |
| 4803 | } | 4675 | } |
| 4804 | s->size = nchars; | 4676 | s->size = nchars; |
| @@ -4831,8 +4703,7 @@ make_pure_c_string (const char *data) | |||
| 4831 | of CAR as car and CDR as cdr. */ | 4703 | of CAR as car and CDR as cdr. */ |
| 4832 | 4704 | ||
| 4833 | Lisp_Object | 4705 | Lisp_Object |
| 4834 | pure_cons (car, cdr) | 4706 | pure_cons (Lisp_Object car, Lisp_Object cdr) |
| 4835 | Lisp_Object car, cdr; | ||
| 4836 | { | 4707 | { |
| 4837 | register Lisp_Object new; | 4708 | register Lisp_Object new; |
| 4838 | struct Lisp_Cons *p; | 4709 | struct Lisp_Cons *p; |
| @@ -4848,8 +4719,7 @@ pure_cons (car, cdr) | |||
| 4848 | /* Value is a float object with value NUM allocated from pure space. */ | 4719 | /* Value is a float object with value NUM allocated from pure space. */ |
| 4849 | 4720 | ||
| 4850 | static Lisp_Object | 4721 | static Lisp_Object |
| 4851 | make_pure_float (num) | 4722 | make_pure_float (double num) |
| 4852 | double num; | ||
| 4853 | { | 4723 | { |
| 4854 | register Lisp_Object new; | 4724 | register Lisp_Object new; |
| 4855 | struct Lisp_Float *p; | 4725 | struct Lisp_Float *p; |
| @@ -4865,8 +4735,7 @@ make_pure_float (num) | |||
| 4865 | pure space. */ | 4735 | pure space. */ |
| 4866 | 4736 | ||
| 4867 | Lisp_Object | 4737 | Lisp_Object |
| 4868 | make_pure_vector (len) | 4738 | make_pure_vector (EMACS_INT len) |
| 4869 | EMACS_INT len; | ||
| 4870 | { | 4739 | { |
| 4871 | Lisp_Object new; | 4740 | Lisp_Object new; |
| 4872 | struct Lisp_Vector *p; | 4741 | struct Lisp_Vector *p; |
| @@ -4883,8 +4752,7 @@ DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0, | |||
| 4883 | doc: /* Make a copy of object OBJ in pure storage. | 4752 | doc: /* Make a copy of object OBJ in pure storage. |
| 4884 | Recursively copies contents of vectors and cons cells. | 4753 | Recursively copies contents of vectors and cons cells. |
| 4885 | Does not copy symbols. Copies strings without text properties. */) | 4754 | Does not copy symbols. Copies strings without text properties. */) |
| 4886 | (obj) | 4755 | (register Lisp_Object obj) |
| 4887 | register Lisp_Object obj; | ||
| 4888 | { | 4756 | { |
| 4889 | if (NILP (Vpurify_flag)) | 4757 | if (NILP (Vpurify_flag)) |
| 4890 | return obj; | 4758 | return obj; |
| @@ -4949,8 +4817,7 @@ Does not copy symbols. Copies strings without text properties. */) | |||
| 4949 | VARADDRESS. */ | 4817 | VARADDRESS. */ |
| 4950 | 4818 | ||
| 4951 | void | 4819 | void |
| 4952 | staticpro (varaddress) | 4820 | staticpro (Lisp_Object *varaddress) |
| 4953 | Lisp_Object *varaddress; | ||
| 4954 | { | 4821 | { |
| 4955 | staticvec[staticidx++] = varaddress; | 4822 | staticvec[staticidx++] = varaddress; |
| 4956 | if (staticidx >= NSTATICS) | 4823 | if (staticidx >= NSTATICS) |
| @@ -4965,7 +4832,7 @@ staticpro (varaddress) | |||
| 4965 | /* Temporarily prevent garbage collection. */ | 4832 | /* Temporarily prevent garbage collection. */ |
| 4966 | 4833 | ||
| 4967 | int | 4834 | int |
| 4968 | inhibit_garbage_collection () | 4835 | inhibit_garbage_collection (void) |
| 4969 | { | 4836 | { |
| 4970 | int count = SPECPDL_INDEX (); | 4837 | int count = SPECPDL_INDEX (); |
| 4971 | int nbits = min (VALBITS, BITS_PER_INT); | 4838 | int nbits = min (VALBITS, BITS_PER_INT); |
| @@ -4986,7 +4853,7 @@ Garbage collection happens automatically if you cons more than | |||
| 4986 | (USED-STRINGS . FREE-STRINGS)) | 4853 | (USED-STRINGS . FREE-STRINGS)) |
| 4987 | However, if there was overflow in pure space, `garbage-collect' | 4854 | However, if there was overflow in pure space, `garbage-collect' |
| 4988 | returns nil, because real GC can't be done. */) | 4855 | returns nil, because real GC can't be done. */) |
| 4989 | () | 4856 | (void) |
| 4990 | { | 4857 | { |
| 4991 | register struct specbinding *bind; | 4858 | register struct specbinding *bind; |
| 4992 | struct catchtag *catch; | 4859 | struct catchtag *catch; |
| @@ -5069,9 +4936,9 @@ returns nil, because real GC can't be done. */) | |||
| 5069 | if (stack_copy) | 4936 | if (stack_copy) |
| 5070 | { | 4937 | { |
| 5071 | if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) | 4938 | if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) |
| 5072 | bcopy (stack_bottom, stack_copy, i); | 4939 | memcpy (stack_copy, stack_bottom, i); |
| 5073 | else | 4940 | else |
| 5074 | bcopy (&stack_top_variable, stack_copy, i); | 4941 | memcpy (stack_copy, &stack_top_variable, i); |
| 5075 | } | 4942 | } |
| 5076 | } | 4943 | } |
| 5077 | } | 4944 | } |
| @@ -5104,7 +4971,7 @@ returns nil, because real GC can't be done. */) | |||
| 5104 | 4971 | ||
| 5105 | #ifdef USE_GTK | 4972 | #ifdef USE_GTK |
| 5106 | { | 4973 | { |
| 5107 | extern void xg_mark_data (); | 4974 | extern void xg_mark_data (void); |
| 5108 | xg_mark_data (); | 4975 | xg_mark_data (); |
| 5109 | } | 4976 | } |
| 5110 | #endif | 4977 | #endif |
| @@ -5297,8 +5164,7 @@ returns nil, because real GC can't be done. */) | |||
| 5297 | only interesting objects referenced from glyphs are strings. */ | 5164 | only interesting objects referenced from glyphs are strings. */ |
| 5298 | 5165 | ||
| 5299 | static void | 5166 | static void |
| 5300 | mark_glyph_matrix (matrix) | 5167 | mark_glyph_matrix (struct glyph_matrix *matrix) |
| 5301 | struct glyph_matrix *matrix; | ||
| 5302 | { | 5168 | { |
| 5303 | struct glyph_row *row = matrix->rows; | 5169 | struct glyph_row *row = matrix->rows; |
| 5304 | struct glyph_row *end = row + matrix->nrows; | 5170 | struct glyph_row *end = row + matrix->nrows; |
| @@ -5324,8 +5190,7 @@ mark_glyph_matrix (matrix) | |||
| 5324 | /* Mark Lisp faces in the face cache C. */ | 5190 | /* Mark Lisp faces in the face cache C. */ |
| 5325 | 5191 | ||
| 5326 | static void | 5192 | static void |
| 5327 | mark_face_cache (c) | 5193 | mark_face_cache (struct face_cache *c) |
| 5328 | struct face_cache *c; | ||
| 5329 | { | 5194 | { |
| 5330 | if (c) | 5195 | if (c) |
| 5331 | { | 5196 | { |
| @@ -5360,8 +5225,7 @@ int last_marked_index; | |||
| 5360 | static int mark_object_loop_halt; | 5225 | static int mark_object_loop_halt; |
| 5361 | 5226 | ||
| 5362 | static void | 5227 | static void |
| 5363 | mark_vectorlike (ptr) | 5228 | mark_vectorlike (struct Lisp_Vector *ptr) |
| 5364 | struct Lisp_Vector *ptr; | ||
| 5365 | { | 5229 | { |
| 5366 | register EMACS_INT size = ptr->size; | 5230 | register EMACS_INT size = ptr->size; |
| 5367 | register int i; | 5231 | register int i; |
| @@ -5384,8 +5248,7 @@ mark_vectorlike (ptr) | |||
| 5384 | symbols. */ | 5248 | symbols. */ |
| 5385 | 5249 | ||
| 5386 | static void | 5250 | static void |
| 5387 | mark_char_table (ptr) | 5251 | mark_char_table (struct Lisp_Vector *ptr) |
| 5388 | struct Lisp_Vector *ptr; | ||
| 5389 | { | 5252 | { |
| 5390 | register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK; | 5253 | register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK; |
| 5391 | register int i; | 5254 | register int i; |
| @@ -5409,8 +5272,7 @@ mark_char_table (ptr) | |||
| 5409 | } | 5272 | } |
| 5410 | 5273 | ||
| 5411 | void | 5274 | void |
| 5412 | mark_object (arg) | 5275 | mark_object (Lisp_Object arg) |
| 5413 | Lisp_Object arg; | ||
| 5414 | { | 5276 | { |
| 5415 | register Lisp_Object obj = arg; | 5277 | register Lisp_Object obj = arg; |
| 5416 | #ifdef GC_CHECK_MARKED_OBJECTS | 5278 | #ifdef GC_CHECK_MARKED_OBJECTS |
| @@ -5719,8 +5581,7 @@ mark_object (arg) | |||
| 5719 | /* Mark the pointers in a buffer structure. */ | 5581 | /* Mark the pointers in a buffer structure. */ |
| 5720 | 5582 | ||
| 5721 | static void | 5583 | static void |
| 5722 | mark_buffer (buf) | 5584 | mark_buffer (Lisp_Object buf) |
| 5723 | Lisp_Object buf; | ||
| 5724 | { | 5585 | { |
| 5725 | register struct buffer *buffer = XBUFFER (buf); | 5586 | register struct buffer *buffer = XBUFFER (buf); |
| 5726 | register Lisp_Object *ptr, tmp; | 5587 | register Lisp_Object *ptr, tmp; |
| @@ -5787,8 +5648,7 @@ mark_terminals (void) | |||
| 5787 | either marked or does not need to be marked to survive. */ | 5648 | either marked or does not need to be marked to survive. */ |
| 5788 | 5649 | ||
| 5789 | int | 5650 | int |
| 5790 | survives_gc_p (obj) | 5651 | survives_gc_p (Lisp_Object obj) |
| 5791 | Lisp_Object obj; | ||
| 5792 | { | 5652 | { |
| 5793 | int survives_p; | 5653 | int survives_p; |
| 5794 | 5654 | ||
| @@ -5834,7 +5694,7 @@ survives_gc_p (obj) | |||
| 5834 | /* Sweep: find all structures not marked, and free them. */ | 5694 | /* Sweep: find all structures not marked, and free them. */ |
| 5835 | 5695 | ||
| 5836 | static void | 5696 | static void |
| 5837 | gc_sweep () | 5697 | gc_sweep (void) |
| 5838 | { | 5698 | { |
| 5839 | /* Remove or mark entries in weak hash tables. | 5699 | /* Remove or mark entries in weak hash tables. |
| 5840 | This must be done before any object is unmarked. */ | 5700 | This must be done before any object is unmarked. */ |
| @@ -6210,7 +6070,7 @@ DEFUN ("memory-limit", Fmemory_limit, Smemory_limit, 0, 0, 0, | |||
| 6210 | doc: /* Return the address of the last byte Emacs has allocated, divided by 1024. | 6070 | doc: /* Return the address of the last byte Emacs has allocated, divided by 1024. |
| 6211 | This may be helpful in debugging Emacs's memory usage. | 6071 | This may be helpful in debugging Emacs's memory usage. |
| 6212 | We divide the value by 1024 to make sure it fits in a Lisp integer. */) | 6072 | We divide the value by 1024 to make sure it fits in a Lisp integer. */) |
| 6213 | () | 6073 | (void) |
| 6214 | { | 6074 | { |
| 6215 | Lisp_Object end; | 6075 | Lisp_Object end; |
| 6216 | 6076 | ||
| @@ -6232,7 +6092,7 @@ objects consed. | |||
| 6232 | MISCS include overlays, markers, and some internal types. | 6092 | MISCS include overlays, markers, and some internal types. |
| 6233 | Frames, windows, buffers, and subprocesses count as vectors | 6093 | Frames, windows, buffers, and subprocesses count as vectors |
| 6234 | (but the contents of a buffer's text do not count here). */) | 6094 | (but the contents of a buffer's text do not count here). */) |
| 6235 | () | 6095 | (void) |
| 6236 | { | 6096 | { |
| 6237 | Lisp_Object consed[8]; | 6097 | Lisp_Object consed[8]; |
| 6238 | 6098 | ||
| @@ -6251,10 +6111,7 @@ Frames, windows, buffers, and subprocesses count as vectors | |||
| 6251 | int suppress_checking; | 6111 | int suppress_checking; |
| 6252 | 6112 | ||
| 6253 | void | 6113 | void |
| 6254 | die (msg, file, line) | 6114 | die (const char *msg, const char *file, int line) |
| 6255 | const char *msg; | ||
| 6256 | const char *file; | ||
| 6257 | int line; | ||
| 6258 | { | 6115 | { |
| 6259 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", | 6116 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", |
| 6260 | file, line, msg); | 6117 | file, line, msg); |
| @@ -6264,7 +6121,7 @@ die (msg, file, line) | |||
| 6264 | /* Initialization */ | 6121 | /* Initialization */ |
| 6265 | 6122 | ||
| 6266 | void | 6123 | void |
| 6267 | init_alloc_once () | 6124 | init_alloc_once (void) |
| 6268 | { | 6125 | { |
| 6269 | /* Used to do Vpurify_flag = Qt here, but Qt isn't set up yet! */ | 6126 | /* Used to do Vpurify_flag = Qt here, but Qt isn't set up yet! */ |
| 6270 | purebeg = PUREBEG; | 6127 | purebeg = PUREBEG; |
| @@ -6311,15 +6168,10 @@ init_alloc_once () | |||
| 6311 | consing_since_gc = 0; | 6168 | consing_since_gc = 0; |
| 6312 | gc_cons_threshold = 100000 * sizeof (Lisp_Object); | 6169 | gc_cons_threshold = 100000 * sizeof (Lisp_Object); |
| 6313 | gc_relative_threshold = 0; | 6170 | gc_relative_threshold = 0; |
| 6314 | |||
| 6315 | #ifdef VIRT_ADDR_VARIES | ||
| 6316 | malloc_sbrk_unused = 1<<22; /* A large number */ | ||
| 6317 | malloc_sbrk_used = 100000; /* as reasonable as any number */ | ||
| 6318 | #endif /* VIRT_ADDR_VARIES */ | ||
| 6319 | } | 6171 | } |
| 6320 | 6172 | ||
| 6321 | void | 6173 | void |
| 6322 | init_alloc () | 6174 | init_alloc (void) |
| 6323 | { | 6175 | { |
| 6324 | gcprolist = 0; | 6176 | gcprolist = 0; |
| 6325 | byte_stack_list = 0; | 6177 | byte_stack_list = 0; |
| @@ -6333,7 +6185,7 @@ init_alloc () | |||
| 6333 | } | 6185 | } |
| 6334 | 6186 | ||
| 6335 | void | 6187 | void |
| 6336 | syms_of_alloc () | 6188 | syms_of_alloc (void) |
| 6337 | { | 6189 | { |
| 6338 | DEFVAR_INT ("gc-cons-threshold", &gc_cons_threshold, | 6190 | DEFVAR_INT ("gc-cons-threshold", &gc_cons_threshold, |
| 6339 | doc: /* *Number of bytes of consing between garbage collections. | 6191 | doc: /* *Number of bytes of consing between garbage collections. |