diff options
| author | Karl Heuer | 1998-01-18 03:19:14 +0000 |
|---|---|---|
| committer | Karl Heuer | 1998-01-18 03:19:14 +0000 |
| commit | b3fd4d8f37775c82fec09b4bf73b1465c1e2e62b (patch) | |
| tree | 9436b37cb44adfa4003d730c7e8899282fc900fa /src/alloc.c | |
| parent | 0f0a7f7cf462fb6f30e753e430966204bd3daba1 (diff) | |
| download | emacs-b3fd4d8f37775c82fec09b4bf73b1465c1e2e62b.tar.gz emacs-b3fd4d8f37775c82fec09b4bf73b1465c1e2e62b.zip | |
(STRING_BASE_SIZE): New macro.
(STRING_FULLSIZE): Use STRING_BASE_SIZE instead of the whole
size of struct Lisp_String.
(make_pure_string): Use STRING_FULLSIZE.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/alloc.c b/src/alloc.c index d6294c69523..b7d60eb5258 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1119,9 +1119,14 @@ struct string_block *large_string_blocks; | |||
| 1119 | /* If SIZE is the length of a string, this returns how many bytes | 1119 | /* If SIZE is the length of a string, this returns how many bytes |
| 1120 | the string occupies in a string_block (including padding). */ | 1120 | the string occupies in a string_block (including padding). */ |
| 1121 | 1121 | ||
| 1122 | #define STRING_FULLSIZE(size) (((size) + sizeof (struct Lisp_String) + PAD) \ | 1122 | #define STRING_FULLSIZE(size) (((size) + 1 + STRING_BASE_SIZE + STRING_PAD - 1) \ |
| 1123 | & ~(PAD - 1)) | 1123 | & ~(STRING_PAD - 1)) |
| 1124 | #define PAD (sizeof (EMACS_INT)) | 1124 | /* Add 1 for the null terminator, |
| 1125 | and add STRING_PAD - 1 as part of rounding up. */ | ||
| 1126 | |||
| 1127 | #define STRING_PAD (sizeof (EMACS_INT)) | ||
| 1128 | /* Size of the stuff in the string not including its data. */ | ||
| 1129 | #define STRING_BASE_SIZE (((sizeof (struct Lisp_String) - 1) / STRING_PAD) * STRING_PAD) | ||
| 1125 | 1130 | ||
| 1126 | #if 0 | 1131 | #if 0 |
| 1127 | #define STRING_FULLSIZE(SIZE) \ | 1132 | #define STRING_FULLSIZE(SIZE) \ |
| @@ -1377,8 +1382,7 @@ make_pure_string (data, length, length_byte) | |||
| 1377 | int length_byte; | 1382 | int length_byte; |
| 1378 | { | 1383 | { |
| 1379 | register Lisp_Object new; | 1384 | register Lisp_Object new; |
| 1380 | register int size = (2 * sizeof (EMACS_INT) | 1385 | register int size = STRING_FULLSIZE (length_byte); |
| 1381 | + INTERVAL_PTR_SIZE + length_byte + 1); | ||
| 1382 | 1386 | ||
| 1383 | if (pureptr + size > PURESIZE) | 1387 | if (pureptr + size > PURESIZE) |
| 1384 | error ("Pure Lisp storage exhausted"); | 1388 | error ("Pure Lisp storage exhausted"); |
| @@ -1393,8 +1397,7 @@ make_pure_string (data, length, length_byte) | |||
| 1393 | #if defined (USE_TEXT_PROPERTIES) | 1397 | #if defined (USE_TEXT_PROPERTIES) |
| 1394 | XSTRING (new)->intervals = NULL_INTERVAL; | 1398 | XSTRING (new)->intervals = NULL_INTERVAL; |
| 1395 | #endif | 1399 | #endif |
| 1396 | pureptr += (size + sizeof (EMACS_INT) - 1) | 1400 | pureptr += size; |
| 1397 | / sizeof (EMACS_INT) * sizeof (EMACS_INT); | ||
| 1398 | return new; | 1401 | return new; |
| 1399 | } | 1402 | } |
| 1400 | 1403 | ||