diff options
| author | Richard M. Stallman | 2006-09-13 15:16:12 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-09-13 15:16:12 +0000 |
| commit | efb15f96f524ea117b7451bf1c099773b1d5e766 (patch) | |
| tree | 966e2e0d90667d3b2d74a84e89d046ddee6db06a /src | |
| parent | 4c0240d20a8d4b3a9f890bdb95d58b9ecdc281e1 (diff) | |
| download | emacs-efb15f96f524ea117b7451bf1c099773b1d5e766.tar.gz emacs-efb15f96f524ea117b7451bf1c099773b1d5e766.zip | |
(print_string): When printcharfun is t,
copy string contents and call strout on the copy.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/print.c | 32 |
2 files changed, 37 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8cafaa59e32..f2125895c2c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2006-09-13 Richard Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * print.c (print_string): When printcharfun is t, | ||
| 4 | copy string contents and call strout on the copy. | ||
| 5 | |||
| 6 | * keyboard.c (read_char): If end_time specified, don't put the | ||
| 7 | event into this_command_keys. | ||
| 8 | (read_key_sequence): If Voverriding_terminal_local_map is specified, | ||
| 9 | don't check Voverriding_local_map at all. | ||
| 10 | |||
| 1 | 2006-09-12 Stefan Monnier <monnier@iro.umontreal.ca> | 11 | 2006-09-12 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 12 | ||
| 3 | * textprop.c (Fnext_property_change, Fnext_single_property_change) | 13 | * textprop.c (Fnext_property_change, Fnext_single_property_change) |
diff --git a/src/print.c b/src/print.c index 13354763f90..57f83cae696 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -364,7 +364,10 @@ printchar (ch, fun) | |||
| 364 | print_buffer. PRINTCHARFUN t means output to the echo area or to | 364 | print_buffer. PRINTCHARFUN t means output to the echo area or to |
| 365 | stdout if non-interactive. If neither nil nor t, call Lisp | 365 | stdout if non-interactive. If neither nil nor t, call Lisp |
| 366 | function PRINTCHARFUN for each character printed. MULTIBYTE | 366 | function PRINTCHARFUN for each character printed. MULTIBYTE |
| 367 | non-zero means PTR contains multibyte characters. */ | 367 | non-zero means PTR contains multibyte characters. |
| 368 | |||
| 369 | In the case where PRINTCHARFUN is nil, it is safe for PTR to point | ||
| 370 | to data in a Lisp string. Otherwise that is not safe. */ | ||
| 368 | 371 | ||
| 369 | static void | 372 | static void |
| 370 | strout (ptr, size, size_byte, printcharfun, multibyte) | 373 | strout (ptr, size, size_byte, printcharfun, multibyte) |
| @@ -497,10 +500,29 @@ print_string (string, printcharfun) | |||
| 497 | else | 500 | else |
| 498 | chars = SBYTES (string); | 501 | chars = SBYTES (string); |
| 499 | 502 | ||
| 500 | /* strout is safe for output to a frame (echo area) or to print_buffer. */ | 503 | if (EQ (printcharfun, Qt)) |
| 501 | strout (SDATA (string), | 504 | { |
| 502 | chars, SBYTES (string), | 505 | /* Output to echo area. */ |
| 503 | printcharfun, STRING_MULTIBYTE (string)); | 506 | int nbytes = SBYTES (string); |
| 507 | char *buffer; | ||
| 508 | |||
| 509 | /* Copy the string contents so that relocation of STRING by | ||
| 510 | GC does not cause trouble. */ | ||
| 511 | USE_SAFE_ALLOCA; | ||
| 512 | |||
| 513 | SAFE_ALLOCA (buffer, char *, nbytes); | ||
| 514 | bcopy (SDATA (string), buffer, nbytes); | ||
| 515 | |||
| 516 | strout (buffer, chars, SBYTES (string), | ||
| 517 | printcharfun, STRING_MULTIBYTE (string)); | ||
| 518 | |||
| 519 | SAFE_FREE (); | ||
| 520 | } | ||
| 521 | else | ||
| 522 | /* No need to copy, since output to print_buffer can't GC. */ | ||
| 523 | strout (SDATA (string), | ||
| 524 | chars, SBYTES (string), | ||
| 525 | printcharfun, STRING_MULTIBYTE (string)); | ||
| 504 | } | 526 | } |
| 505 | else | 527 | else |
| 506 | { | 528 | { |