emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 97bf923: Fix minor bugs with printing null bytes


From: Paul Eggert
Subject: [Emacs-diffs] master 97bf923: Fix minor bugs with printing null bytes
Date: Tue, 20 Jan 2015 04:29:30 +0000

branch: master
commit 97bf923892a781b71442562510c9ef8492eb1dfe
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix minor bugs with printing null bytes
    
    * minibuf.c (read_minibuf_noninteractive):
    * xdisp.c (Ftrace_to_stderr) [GLYPH_DEBUG]:
    Work even if the Lisp string contains a null byte.
---
 src/ChangeLog |    5 +++++
 src/minibuf.c |    2 +-
 src/xdisp.c   |    2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index b77f00c..ad7780f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
 2015-01-20  Paul Eggert  <address@hidden>
 
+       Fix minor bugs with printing null bytes
+       * minibuf.c (read_minibuf_noninteractive):
+       * xdisp.c (Ftrace_to_stderr) [GLYPH_DEBUG]:
+       Work even if the Lisp string contains a null byte.
+
        Port to hypothetical case where Qnil is nonzero
        * alloc.c (allocate_pseudovector):
        * callint.c (Fcall_interactively):
diff --git a/src/minibuf.c b/src/minibuf.c
index 07f4892..0d6e2c7 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -217,7 +217,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object 
initial,
       suppress_echo_on_tty (fileno (stdin));
     }
 
-  fprintf (stdout, "%s", SDATA (prompt));
+  fwrite (SDATA (prompt), 1, SBYTES (prompt), stdout);
   fflush (stdout);
 
   val = Qnil;
diff --git a/src/xdisp.c b/src/xdisp.c
index 8d53274..9abaeb0 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -18815,7 +18815,7 @@ usage: (trace-to-stderr STRING &rest OBJECTS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
   Lisp_Object s = Fformat (nargs, args);
-  fprintf (stderr, "%s", SDATA (s));
+  fwrite (SDATA (s), 1, SBYTES (s), stderr);
   return Qnil;
 }
 



reply via email to

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