emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/print.c,v


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/src/print.c,v
Date: Wed, 13 Sep 2006 15:15:54 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       06/09/13 15:15:54

Index: print.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/print.c,v
retrieving revision 1.227
retrieving revision 1.228
diff -u -b -r1.227 -r1.228
--- print.c     8 Sep 2006 11:38:58 -0000       1.227
+++ print.c     13 Sep 2006 15:15:54 -0000      1.228
@@ -364,7 +364,10 @@
    print_buffer.  PRINTCHARFUN t means output to the echo area or to
    stdout if non-interactive.  If neither nil nor t, call Lisp
    function PRINTCHARFUN for each character printed.  MULTIBYTE
-   non-zero means PTR contains multibyte characters.  */
+   non-zero means PTR contains multibyte characters.
+
+   In the case where PRINTCHARFUN is nil, it is safe for PTR to point
+   to data in a Lisp string.  Otherwise that is not safe.  */
 
 static void
 strout (ptr, size, size_byte, printcharfun, multibyte)
@@ -497,7 +500,26 @@
       else
        chars = SBYTES (string);
 
-      /* strout is safe for output to a frame (echo area) or to print_buffer.  
*/
+      if (EQ (printcharfun, Qt))
+       {
+         /* Output to echo area.  */
+         int nbytes = SBYTES (string);
+         char *buffer;
+
+         /* Copy the string contents so that relocation of STRING by
+            GC does not cause trouble.  */
+         USE_SAFE_ALLOCA;
+
+         SAFE_ALLOCA (buffer, char *, nbytes);
+         bcopy (SDATA (string), buffer, nbytes);
+
+         strout (buffer, chars, SBYTES (string),
+                 printcharfun, STRING_MULTIBYTE (string));
+
+         SAFE_FREE ();
+       }
+      else
+       /* No need to copy, since output to print_buffer can't GC.  */
       strout (SDATA (string),
              chars, SBYTES (string),
              printcharfun, STRING_MULTIBYTE (string));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]