emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r116196: Fix bug #16576 with PRINTCHARFUN that conse


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r116196: Fix bug #16576 with PRINTCHARFUN that conses output a lot.
Date: Wed, 29 Jan 2014 17:53:11 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116196
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16576
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Wed 2014-01-29 19:52:16 +0200
message:
  Fix bug #16576 with PRINTCHARFUN that conses output a lot.
  
   src/print.c (print_object): Use FETCH_STRING_CHAR_ADVANCE, not
   STRING_CHAR_AND_LENGTH, so that if the string is relocated by GC,
   we still use correct addresses.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/print.c                    print.c-20091113204419-o5vbwnq5f7feedwu-262
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-01-29 13:39:00 +0000
+++ b/src/ChangeLog     2014-01-29 17:52:16 +0000
@@ -1,3 +1,9 @@
+2014-01-29  Eli Zaretskii  <address@hidden>
+
+       * print.c (print_object): Use FETCH_STRING_CHAR_ADVANCE, not
+       STRING_CHAR_AND_LENGTH, so that if the string is relocated by GC,
+       we still use correct addresses.  (Bug#16576)
+
 2014-01-27  K. Handa  <address@hidden>
 
        Fix bug#16286 by the different way than revno:116158 to preserve

=== modified file 'src/print.c'
--- a/src/print.c       2014-01-01 07:43:34 +0000
+++ b/src/print.c       2014-01-29 17:52:16 +0000
@@ -1389,9 +1389,8 @@
        print_string (obj, printcharfun);
       else
        {
-         register ptrdiff_t i_byte;
+         register ptrdiff_t i, i_byte;
          struct gcpro gcpro1;
-         unsigned char *str;
          ptrdiff_t size_byte;
          /* 1 means we must ensure that the next character we output
             cannot be taken as part of a hex character escape.  */
@@ -1410,23 +1409,15 @@
            }
 
          PRINTCHAR ('\"');
-         str = SDATA (obj);
          size_byte = SBYTES (obj);
 
-         for (i_byte = 0; i_byte < size_byte;)
+         for (i = 0, i_byte = 0; i_byte < size_byte;)
            {
              /* Here, we must convert each multi-byte form to the
                 corresponding character code before handing it to PRINTCHAR.  
*/
-             int len;
              int c;
 
-             if (multibyte)
-               {
-                 c = STRING_CHAR_AND_LENGTH (str + i_byte, len);
-                 i_byte += len;
-               }
-             else
-               c = str[i_byte++];
+             FETCH_STRING_CHAR_ADVANCE (c, obj, i, i_byte);
 
              QUIT;
 


reply via email to

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