GNU bug report logs -
#78590
31.0.50; print_object calls strout unsafely
Previous Next
Full log
View this message in rfc822 format
"Eli Zaretskii" <eliz <at> gnu.org> writes:
>> Date: Tue, 27 May 2025 18:46:24 +0000
>> From: Pip Cet <pipcet <at> protonmail.com>
>> Cc: 78590 <at> debbugs.gnu.org
>>
>> "Eli Zaretskii" <eliz <at> gnu.org> writes:
>>
>> else
>> {
>> - /* Otherwise, string may be relocated by printing one char.
>> - So re-fetch the string address for each character. */
>> - ptrdiff_t i;
>> - ptrdiff_t size = SCHARS (string);
>> - ptrdiff_t size_byte = SBYTES (string);
>> - if (size == size_byte)
>> - for (i = 0; i < size; i++)
>> - printchar (SREF (string, i), printcharfun);
>> - else
>> - for (i = 0; i < size_byte; )
>> - {
>> - /* Here, we must convert each multi-byte form to the
>> - corresponding character code before handing it to PRINTCHAR. */
>> - int len, ch = string_char_and_length (SDATA (string) + i, &len);
>> - printchar (ch, printcharfun);
>> - i += len;
>> - }
>> + /* printcharfun is a Lisp function. */
>> + Fmapc (printcharfun, string);
>
> What is the rationale for calling Fmapc here? Doesn't it do in this
> case what the original code did, but at a price of two additional
> levels of function calls? IOW, why did you want to get rid of the
> original code above?
Let's leave out that hunk for now? We can replace it by Fmapc when
Fmapc is fixed for bug#75845. I see calling mapc on a record crashes
now, so I'll try to come up with an updated patch for bug#75845 that
fixes both that issue and the self-modification thing.
Pip
This bug report was last modified 18 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.