mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-23 13:02:00 -08:00
Fix bug in recent allocate_string_data patch
Reported by Glenn Morris in: https://lists.gnu.org/r/emacs-devel/2020-01/msg00098.html * src/alloc.c (allocate_string_data): If the string is small and there is not enough room in the current block, clear the string if CLEARIT.
This commit is contained in:
parent
9bbf175398
commit
add2b2da72
1 changed files with 18 additions and 17 deletions
35
src/alloc.c
35
src/alloc.c
|
|
@ -1831,26 +1831,27 @@ allocate_string_data (struct Lisp_String *s,
|
|||
b->next_free = data;
|
||||
large_sblocks = b;
|
||||
}
|
||||
else if (current_sblock == NULL
|
||||
|| (((char *) current_sblock + SBLOCK_SIZE
|
||||
- (char *) current_sblock->next_free)
|
||||
< (needed + GC_STRING_EXTRA)))
|
||||
{
|
||||
/* Not enough room in the current sblock. */
|
||||
b = lisp_malloc (SBLOCK_SIZE, false, MEM_TYPE_NON_LISP);
|
||||
data = b->data;
|
||||
b->next = NULL;
|
||||
b->next_free = data;
|
||||
|
||||
if (current_sblock)
|
||||
current_sblock->next = b;
|
||||
else
|
||||
oldest_sblock = b;
|
||||
current_sblock = b;
|
||||
}
|
||||
else
|
||||
{
|
||||
b = current_sblock;
|
||||
|
||||
if (b == NULL
|
||||
|| (SBLOCK_SIZE - GC_STRING_EXTRA
|
||||
< (char *) b->next_free - (char *) b + needed))
|
||||
{
|
||||
/* Not enough room in the current sblock. */
|
||||
b = lisp_malloc (SBLOCK_SIZE, false, MEM_TYPE_NON_LISP);
|
||||
data = b->data;
|
||||
b->next = NULL;
|
||||
b->next_free = data;
|
||||
|
||||
if (current_sblock)
|
||||
current_sblock->next = b;
|
||||
else
|
||||
oldest_sblock = b;
|
||||
current_sblock = b;
|
||||
}
|
||||
|
||||
data = b->next_free;
|
||||
if (clearit)
|
||||
memset (SDATA_DATA (data), 0, nbytes);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue