Martin Buchholz <martin(a)xemacs.org> writes:
Here's a new patch, containing ONLY bug fixes, and incorporating
Hrvoje's suggestions:
Seconded, for now. (Except for the ChangeLog, for which see Jan's
mail.)
if (LISTP (seq))
{
+ /* A devious `fn' could either:
+ - insert garbage into the list in front of us, causing XCDR to crash
+ - break the list behind us using (setcdr), causing the remaining elts
+ to lose their GCPRO status.
+
+ We avoid these problems by making a copy of the list to be traversed.
+
+ (We could also use EXTERNAL_LIST_LOOP and GCPRO the tail).
I think we should do that -- use EXTERNAL_LIST_LOOP and GCPRO the
tail. XEmacs is already *very* stack-hungry and copies a lot. All
unnecessary copying should be avoided.
- Bufbyte *p = XSTRING_DATA (seq);
- for (i = 0; i < leni; i++)
+ /* The string data of `seq' might be relocated during GC. */
Also, someone could change the characters in the [0, i) range, and
relocate string's chars under us by changing the byte length of a
character before us. (See set_string_char() and resize_string().)