diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 67 |
1 files changed, 32 insertions, 35 deletions
diff --git a/src/alloc.c b/src/alloc.c index 76d0f64efa5..91e6297a23b 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -42,7 +42,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 42 | do \ | 42 | do \ |
| 43 | { \ | 43 | { \ |
| 44 | Lisp_Object val; \ | 44 | Lisp_Object val; \ |
| 45 | XSET (val, Lisp_Cons, (char *) address + size); \ | 45 | XSETCONS (val, (char *) address + size); \ |
| 46 | if ((char *) XCONS (val) != (char *) address + size) \ | 46 | if ((char *) XCONS (val) != (char *) address + size) \ |
| 47 | { \ | 47 | { \ |
| 48 | xfree (address); \ | 48 | xfree (address); \ |
| @@ -447,7 +447,7 @@ make_float (float_value) | |||
| 447 | 447 | ||
| 448 | if (float_free_list) | 448 | if (float_free_list) |
| 449 | { | 449 | { |
| 450 | XSET (val, Lisp_Float, float_free_list); | 450 | XSETFLOAT (val, float_free_list); |
| 451 | float_free_list = (struct Lisp_Float *) XFASTINT (float_free_list->type); | 451 | float_free_list = (struct Lisp_Float *) XFASTINT (float_free_list->type); |
| 452 | } | 452 | } |
| 453 | else | 453 | else |
| @@ -460,7 +460,7 @@ make_float (float_value) | |||
| 460 | float_block = new; | 460 | float_block = new; |
| 461 | float_block_index = 0; | 461 | float_block_index = 0; |
| 462 | } | 462 | } |
| 463 | XSET (val, Lisp_Float, &float_block->floats[float_block_index++]); | 463 | XSETFLOAT (val, &float_block->floats[float_block_index++]); |
| 464 | } | 464 | } |
| 465 | XFLOAT (val)->data = float_value; | 465 | XFLOAT (val)->data = float_value; |
| 466 | XFASTINT (XFLOAT (val)->type) = 0; /* bug chasing -wsr */ | 466 | XFASTINT (XFLOAT (val)->type) = 0; /* bug chasing -wsr */ |
| @@ -521,7 +521,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 521 | 521 | ||
| 522 | if (cons_free_list) | 522 | if (cons_free_list) |
| 523 | { | 523 | { |
| 524 | XSET (val, Lisp_Cons, cons_free_list); | 524 | XSETCONS (val, cons_free_list); |
| 525 | cons_free_list = (struct Lisp_Cons *) XFASTINT (cons_free_list->car); | 525 | cons_free_list = (struct Lisp_Cons *) XFASTINT (cons_free_list->car); |
| 526 | } | 526 | } |
| 527 | else | 527 | else |
| @@ -534,7 +534,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 534 | cons_block = new; | 534 | cons_block = new; |
| 535 | cons_block_index = 0; | 535 | cons_block_index = 0; |
| 536 | } | 536 | } |
| 537 | XSET (val, Lisp_Cons, &cons_block->conses[cons_block_index++]); | 537 | XSETCONS (val, &cons_block->conses[cons_block_index++]); |
| 538 | } | 538 | } |
| 539 | XCONS (val)->car = car; | 539 | XCONS (val)->car = car; |
| 540 | XCONS (val)->cdr = cdr; | 540 | XCONS (val)->cdr = cdr; |
| @@ -601,7 +601,7 @@ See also the function `vector'.") | |||
| 601 | p = (struct Lisp_Vector *) xmalloc (sizeof (struct Lisp_Vector) + (sizei - 1) * sizeof (Lisp_Object)); | 601 | p = (struct Lisp_Vector *) xmalloc (sizeof (struct Lisp_Vector) + (sizei - 1) * sizeof (Lisp_Object)); |
| 602 | VALIDATE_LISP_STORAGE (p, 0); | 602 | VALIDATE_LISP_STORAGE (p, 0); |
| 603 | 603 | ||
| 604 | XSET (vector, Lisp_Vector, p); | 604 | XSETVECTOR (vector, p); |
| 605 | consing_since_gc += sizeof (struct Lisp_Vector) + (sizei - 1) * sizeof (Lisp_Object); | 605 | consing_since_gc += sizeof (struct Lisp_Vector) + (sizei - 1) * sizeof (Lisp_Object); |
| 606 | 606 | ||
| 607 | p->size = sizei; | 607 | p->size = sizei; |
| @@ -707,7 +707,7 @@ Its value and function definition are void, and its property list is nil.") | |||
| 707 | 707 | ||
| 708 | if (symbol_free_list) | 708 | if (symbol_free_list) |
| 709 | { | 709 | { |
| 710 | XSET (val, Lisp_Symbol, symbol_free_list); | 710 | XSETSYMBOL (val, symbol_free_list); |
| 711 | symbol_free_list | 711 | symbol_free_list |
| 712 | = (struct Lisp_Symbol *) XFASTINT (symbol_free_list->value); | 712 | = (struct Lisp_Symbol *) XFASTINT (symbol_free_list->value); |
| 713 | } | 713 | } |
| @@ -721,7 +721,7 @@ Its value and function definition are void, and its property list is nil.") | |||
| 721 | symbol_block = new; | 721 | symbol_block = new; |
| 722 | symbol_block_index = 0; | 722 | symbol_block_index = 0; |
| 723 | } | 723 | } |
| 724 | XSET (val, Lisp_Symbol, &symbol_block->symbols[symbol_block_index++]); | 724 | XSETSYMBOL (val, &symbol_block->symbols[symbol_block_index++]); |
| 725 | } | 725 | } |
| 726 | p = XSYMBOL (val); | 726 | p = XSYMBOL (val); |
| 727 | p->name = XSTRING (str); | 727 | p->name = XSTRING (str); |
| @@ -769,7 +769,7 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, | |||
| 769 | 769 | ||
| 770 | if (marker_free_list) | 770 | if (marker_free_list) |
| 771 | { | 771 | { |
| 772 | XSET (val, Lisp_Marker, marker_free_list); | 772 | XSETMARKER (val, marker_free_list); |
| 773 | marker_free_list | 773 | marker_free_list |
| 774 | = (struct Lisp_Marker *) XFASTINT (marker_free_list->chain); | 774 | = (struct Lisp_Marker *) XFASTINT (marker_free_list->chain); |
| 775 | } | 775 | } |
| @@ -783,7 +783,7 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, | |||
| 783 | marker_block = new; | 783 | marker_block = new; |
| 784 | marker_block_index = 0; | 784 | marker_block_index = 0; |
| 785 | } | 785 | } |
| 786 | XSET (val, Lisp_Marker, &marker_block->markers[marker_block_index++]); | 786 | XSETMARKER (val, &marker_block->markers[marker_block_index++]); |
| 787 | } | 787 | } |
| 788 | p = XMARKER (val); | 788 | p = XMARKER (val); |
| 789 | p->buffer = 0; | 789 | p->buffer = 0; |
| @@ -918,8 +918,9 @@ make_uninit_string (length) | |||
| 918 | if (fullsize <= STRING_BLOCK_SIZE - current_string_block->pos) | 918 | if (fullsize <= STRING_BLOCK_SIZE - current_string_block->pos) |
| 919 | /* This string can fit in the current string block */ | 919 | /* This string can fit in the current string block */ |
| 920 | { | 920 | { |
| 921 | XSET (val, Lisp_String, | 921 | XSETSTRING (val, |
| 922 | (struct Lisp_String *) (current_string_block->chars + current_string_block->pos)); | 922 | ((struct Lisp_String *) |
| 923 | (current_string_block->chars + current_string_block->pos))); | ||
| 923 | current_string_block->pos += fullsize; | 924 | current_string_block->pos += fullsize; |
| 924 | } | 925 | } |
| 925 | else if (fullsize > STRING_BLOCK_OUTSIZE) | 926 | else if (fullsize > STRING_BLOCK_OUTSIZE) |
| @@ -932,8 +933,9 @@ make_uninit_string (length) | |||
| 932 | new->pos = fullsize; | 933 | new->pos = fullsize; |
| 933 | new->next = large_string_blocks; | 934 | new->next = large_string_blocks; |
| 934 | large_string_blocks = new; | 935 | large_string_blocks = new; |
| 935 | XSET (val, Lisp_String, | 936 | XSETSTRING (val, |
| 936 | (struct Lisp_String *) ((struct string_block_head *)new + 1)); | 937 | ((struct Lisp_String *) |
| 938 | ((struct string_block_head *)new + 1))); | ||
| 937 | } | 939 | } |
| 938 | else | 940 | else |
| 939 | /* Make a new current string block and start it off with this string */ | 941 | /* Make a new current string block and start it off with this string */ |
| @@ -947,8 +949,8 @@ make_uninit_string (length) | |||
| 947 | new->next = 0; | 949 | new->next = 0; |
| 948 | current_string_block = new; | 950 | current_string_block = new; |
| 949 | new->pos = fullsize; | 951 | new->pos = fullsize; |
| 950 | XSET (val, Lisp_String, | 952 | XSETSTRING (val, |
| 951 | (struct Lisp_String *) current_string_block->chars); | 953 | (struct Lisp_String *) current_string_block->chars); |
| 952 | } | 954 | } |
| 953 | 955 | ||
| 954 | XSTRING (val)->size = length; | 956 | XSTRING (val)->size = length; |
| @@ -1014,7 +1016,7 @@ make_pure_string (data, length) | |||
| 1014 | 1016 | ||
| 1015 | if (pureptr + size > PURESIZE) | 1017 | if (pureptr + size > PURESIZE) |
| 1016 | error ("Pure Lisp storage exhausted"); | 1018 | error ("Pure Lisp storage exhausted"); |
| 1017 | XSET (new, Lisp_String, PUREBEG + pureptr); | 1019 | XSETSTRING (new, PUREBEG + pureptr); |
| 1018 | XSTRING (new)->size = length; | 1020 | XSTRING (new)->size = length; |
| 1019 | bcopy (data, XSTRING (new)->data, length); | 1021 | bcopy (data, XSTRING (new)->data, length); |
| 1020 | XSTRING (new)->data[length] = 0; | 1022 | XSTRING (new)->data[length] = 0; |
| @@ -1037,7 +1039,7 @@ pure_cons (car, cdr) | |||
| 1037 | 1039 | ||
| 1038 | if (pureptr + sizeof (struct Lisp_Cons) > PURESIZE) | 1040 | if (pureptr + sizeof (struct Lisp_Cons) > PURESIZE) |
| 1039 | error ("Pure Lisp storage exhausted"); | 1041 | error ("Pure Lisp storage exhausted"); |
| 1040 | XSET (new, Lisp_Cons, PUREBEG + pureptr); | 1042 | XSETCONS (new, PUREBEG + pureptr); |
| 1041 | pureptr += sizeof (struct Lisp_Cons); | 1043 | pureptr += sizeof (struct Lisp_Cons); |
| 1042 | XCONS (new)->car = Fpurecopy (car); | 1044 | XCONS (new)->car = Fpurecopy (car); |
| 1043 | XCONS (new)->cdr = Fpurecopy (cdr); | 1045 | XCONS (new)->cdr = Fpurecopy (cdr); |
| @@ -1075,7 +1077,7 @@ make_pure_float (num) | |||
| 1075 | 1077 | ||
| 1076 | if (pureptr + sizeof (struct Lisp_Float) > PURESIZE) | 1078 | if (pureptr + sizeof (struct Lisp_Float) > PURESIZE) |
| 1077 | error ("Pure Lisp storage exhausted"); | 1079 | error ("Pure Lisp storage exhausted"); |
| 1078 | XSET (new, Lisp_Float, PUREBEG + pureptr); | 1080 | XSETFLOAT (new, PUREBEG + pureptr); |
| 1079 | pureptr += sizeof (struct Lisp_Float); | 1081 | pureptr += sizeof (struct Lisp_Float); |
| 1080 | XFLOAT (new)->data = num; | 1082 | XFLOAT (new)->data = num; |
| 1081 | XFASTINT (XFLOAT (new)->type) = 0; /* bug chasing -wsr */ | 1083 | XFASTINT (XFLOAT (new)->type) = 0; /* bug chasing -wsr */ |
| @@ -1094,7 +1096,7 @@ make_pure_vector (len) | |||
| 1094 | if (pureptr + size > PURESIZE) | 1096 | if (pureptr + size > PURESIZE) |
| 1095 | error ("Pure Lisp storage exhausted"); | 1097 | error ("Pure Lisp storage exhausted"); |
| 1096 | 1098 | ||
| 1097 | XSET (new, Lisp_Vector, PUREBEG + pureptr); | 1099 | XSETVECTOR (new, PUREBEG + pureptr); |
| 1098 | pureptr += size; | 1100 | pureptr += size; |
| 1099 | XVECTOR (new)->size = len; | 1101 | XVECTOR (new)->size = len; |
| 1100 | return new; | 1102 | return new; |
| @@ -1690,18 +1692,14 @@ mark_buffer (buf) | |||
| 1690 | Since the strings may be relocated, we must mark them | 1692 | Since the strings may be relocated, we must mark them |
| 1691 | in their actual slots. So gc_sweep must convert each slot | 1693 | in their actual slots. So gc_sweep must convert each slot |
| 1692 | back to an ordinary C pointer. */ | 1694 | back to an ordinary C pointer. */ |
| 1693 | XSET (*(Lisp_Object *)&buffer->upcase_table, | 1695 | XSETSTRING (*(Lisp_Object *)&buffer->upcase_table, buffer->upcase_table); |
| 1694 | Lisp_String, buffer->upcase_table); | ||
| 1695 | mark_object ((Lisp_Object *)&buffer->upcase_table); | 1696 | mark_object ((Lisp_Object *)&buffer->upcase_table); |
| 1696 | XSET (*(Lisp_Object *)&buffer->downcase_table, | 1697 | XSETSTRING (*(Lisp_Object *)&buffer->downcase_table, buffer->downcase_table); |
| 1697 | Lisp_String, buffer->downcase_table); | ||
| 1698 | mark_object ((Lisp_Object *)&buffer->downcase_table); | 1698 | mark_object ((Lisp_Object *)&buffer->downcase_table); |
| 1699 | 1699 | ||
| 1700 | XSET (*(Lisp_Object *)&buffer->sort_table, | 1700 | XSETSTRING (*(Lisp_Object *)&buffer->sort_table, buffer->sort_table); |
| 1701 | Lisp_String, buffer->sort_table); | ||
| 1702 | mark_object ((Lisp_Object *)&buffer->sort_table); | 1701 | mark_object ((Lisp_Object *)&buffer->sort_table); |
| 1703 | XSET (*(Lisp_Object *)&buffer->folding_sort_table, | 1702 | XSETSTRING (*(Lisp_Object *)&buffer->folding_sort_table, buffer->folding_sort_table); |
| 1704 | Lisp_String, buffer->folding_sort_table); | ||
| 1705 | mark_object ((Lisp_Object *)&buffer->folding_sort_table); | 1703 | mark_object ((Lisp_Object *)&buffer->folding_sort_table); |
| 1706 | #endif | 1704 | #endif |
| 1707 | 1705 | ||
| @@ -1863,7 +1861,7 @@ gc_sweep () | |||
| 1863 | { | 1861 | { |
| 1864 | Lisp_Object tem; | 1862 | Lisp_Object tem; |
| 1865 | tem1 = &mblk->markers[i]; /* tem1 avoids Sun compiler bug */ | 1863 | tem1 = &mblk->markers[i]; /* tem1 avoids Sun compiler bug */ |
| 1866 | XSET (tem, Lisp_Marker, tem1); | 1864 | XSETMARKER (tem, tem1); |
| 1867 | unchain_marker (tem); | 1865 | unchain_marker (tem); |
| 1868 | XFASTINT (mblk->markers[i].chain) = (EMACS_INT) marker_free_list; | 1866 | XFASTINT (mblk->markers[i].chain) = (EMACS_INT) marker_free_list; |
| 1869 | marker_free_list = &mblk->markers[i]; | 1867 | marker_free_list = &mblk->markers[i]; |
| @@ -2055,11 +2053,11 @@ compact_strings () | |||
| 2055 | size = XFASTINT (*objptr) & ~MARKBIT; | 2053 | size = XFASTINT (*objptr) & ~MARKBIT; |
| 2056 | if (XMARKBIT (*objptr)) | 2054 | if (XMARKBIT (*objptr)) |
| 2057 | { | 2055 | { |
| 2058 | XSET (*objptr, Lisp_String, newaddr); | 2056 | XSETSTRING (*objptr, newaddr); |
| 2059 | XMARK (*objptr); | 2057 | XMARK (*objptr); |
| 2060 | } | 2058 | } |
| 2061 | else | 2059 | else |
| 2062 | XSET (*objptr, Lisp_String, newaddr); | 2060 | XSETSTRING (*objptr, newaddr); |
| 2063 | } | 2061 | } |
| 2064 | /* Store the actual size in the size field. */ | 2062 | /* Store the actual size in the size field. */ |
| 2065 | newaddr->size = size; | 2063 | newaddr->size = size; |
| @@ -2070,9 +2068,8 @@ compact_strings () | |||
| 2070 | if (! NULL_INTERVAL_P (newaddr->intervals)) | 2068 | if (! NULL_INTERVAL_P (newaddr->intervals)) |
| 2071 | { | 2069 | { |
| 2072 | UNMARK_BALANCE_INTERVALS (newaddr->intervals); | 2070 | UNMARK_BALANCE_INTERVALS (newaddr->intervals); |
| 2073 | XSET (* (Lisp_Object *) &newaddr->intervals->parent, | 2071 | XSETSTRING (* (Lisp_Object *) &newaddr->intervals->parent, |
| 2074 | Lisp_String, | 2072 | newaddr); |
| 2075 | newaddr); | ||
| 2076 | } | 2073 | } |
| 2077 | #endif /* USE_TEXT_PROPERTIES */ | 2074 | #endif /* USE_TEXT_PROPERTIES */ |
| 2078 | } | 2075 | } |
| @@ -2121,7 +2118,7 @@ We divide the value by 1024 to make sure it fits in a Lisp integer.") | |||
| 2121 | { | 2118 | { |
| 2122 | Lisp_Object end; | 2119 | Lisp_Object end; |
| 2123 | 2120 | ||
| 2124 | XSET (end, Lisp_Int, (EMACS_INT) sbrk (0) / 1024); | 2121 | XSETINT (end, (EMACS_INT) sbrk (0) / 1024); |
| 2125 | 2122 | ||
| 2126 | return end; | 2123 | return end; |
| 2127 | } | 2124 | } |