comparison src/editfns.c @ 50746:2a57a6e6b390

(Fformat): Set abort_on_gc during first scan of format. Reinit FORMAT_START and END before second scan.
author Richard M. Stallman <rms@gnu.org>
date Wed, 30 Apr 2003 12:05:37 +0000
parents 37d227b879ad
children edeae7524de9
comparison
equal deleted inserted replaced
50745:fedd03de0f46 50746:2a57a6e6b390
3253 3253
3254 CHECK_STRING (args[0]); 3254 CHECK_STRING (args[0]);
3255 /* We may have to change "%S" to "%s". */ 3255 /* We may have to change "%S" to "%s". */
3256 args[0] = Fcopy_sequence (args[0]); 3256 args[0] = Fcopy_sequence (args[0]);
3257 3257
3258 /* GC should never happen here, so abort if it does. */
3259 abort_on_gc++;
3260
3258 /* If we start out planning a unibyte result, 3261 /* If we start out planning a unibyte result,
3259 and later find it has to be multibyte, we jump back to retry. */ 3262 then discover it has to be multibyte, we jump back to retry.
3263 That can only happen from the first large while loop below. */
3260 retry: 3264 retry:
3261 3265
3262 format = SDATA (args[0]); 3266 format = SDATA (args[0]);
3263 format_start = format; 3267 format_start = format;
3264 end = format + SBYTES (args[0]); 3268 end = format + SBYTES (args[0]);
3454 3458
3455 thissize += max (0, field_width - actual_width); 3459 thissize += max (0, field_width - actual_width);
3456 total += thissize + 4; 3460 total += thissize + 4;
3457 } 3461 }
3458 3462
3463 abort_on_gc--;
3464
3459 /* Now we can no longer jump to retry. 3465 /* Now we can no longer jump to retry.
3460 TOTAL and LONGEST_FORMAT are known for certain. */ 3466 TOTAL and LONGEST_FORMAT are known for certain. */
3461 3467
3462 this_format = (unsigned char *) alloca (longest_format + 1); 3468 this_format = (unsigned char *) alloca (longest_format + 1);
3463 3469
3472 nchars = 0; 3478 nchars = 0;
3473 n = 0; 3479 n = 0;
3474 3480
3475 /* Scan the format and store result in BUF. */ 3481 /* Scan the format and store result in BUF. */
3476 format = SDATA (args[0]); 3482 format = SDATA (args[0]);
3483 format_start = format;
3484 end = format + SBYTES (args[0]);
3477 maybe_combine_byte = 0; 3485 maybe_combine_byte = 0;
3478 while (format != end) 3486 while (format != end)
3479 { 3487 {
3480 if (*format == '%') 3488 if (*format == '%')
3481 { 3489 {