about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2017-08-07 20:17:45 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2017-08-07 22:25:15 +0200
commitd0916c57ca480cb1a7672c02cda00ec008a50c3c (patch)
tree4e3a2425c22dcc1c05c854224f86bb155d144393
parent26dd77f4f3ec4adfa22cb6dfd25fafc5b55b7466 (diff)
downloadrust-d0916c57ca480cb1a7672c02cda00ec008a50c3c.tar.gz
rust-d0916c57ca480cb1a7672c02cda00ec008a50c3c.zip
Remove \0 printing
-rw-r--r--src/librustdoc/html/markdown.rs10
-rw-r--r--src/test/rustdoc/nul-error.rs2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index cd58ff3109f..35d0f0a116d 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -530,7 +530,7 @@ extern {
     fn hoedown_buffer_new(unit: libc::size_t) -> *mut hoedown_buffer;
     fn hoedown_buffer_puts(b: *mut hoedown_buffer, c: *const libc::c_char);
     fn hoedown_buffer_free(b: *mut hoedown_buffer);
-    fn hoedown_buffer_put(b: *mut hoedown_buffer, c: *const libc::c_char, len: libc::size_t);
+    fn hoedown_buffer_put(b: *mut hoedown_buffer, c: *const u8, len: libc::size_t);
 }
 
 impl hoedown_buffer {
@@ -620,7 +620,7 @@ pub fn render(w: &mut fmt::Formatter,
                                Some("rust-example-rendered"),
                                None,
                                playground_button.as_ref().map(String::as_str)));
-                hoedown_buffer_put(ob, s.as_ptr() as *const libc::c_char, s.len());
+                hoedown_buffer_put(ob, s.as_ptr(), s.len());
             })
         }
     }
@@ -680,7 +680,7 @@ pub fn render(w: &mut fmt::Formatter,
                            <a href='#{id}'>{sec}{}</a></h{lvl}>",
                            s, lvl = level, id = id, sec = sec);
 
-        unsafe { hoedown_buffer_put(ob, text.as_ptr() as *const libc::c_char, text.len()); }
+        unsafe { hoedown_buffer_put(ob, text.as_ptr(), text.len()); }
     }
 
     extern fn codespan(
@@ -697,9 +697,9 @@ pub fn render(w: &mut fmt::Formatter,
             collapse_whitespace(s)
         };
 
-        let content = format!("<code>{}</code>", Escape(&content)).replace("\0", "\\0");
+        let content = format!("<code>{}</code>", Escape(&content));
         unsafe {
-            hoedown_buffer_put(ob, content.as_ptr() as *const libc::c_char, content.len());
+            hoedown_buffer_put(ob, content.as_ptr(), content.len());
         }
         // Return anything except 0, which would mean "also print the code span verbatim".
         1
diff --git a/src/test/rustdoc/nul-error.rs b/src/test/rustdoc/nul-error.rs
index f20d19d0e59..2c9d07f190d 100644
--- a/src/test/rustdoc/nul-error.rs
+++ b/src/test/rustdoc/nul-error.rs
@@ -13,6 +13,6 @@
 
 #![crate_name = "foo"]
 
-// @has foo/fn.foo.html '//code' '0'
+// @has foo/fn.foo.html '//code' ''
 #[doc = "Attempted to pass a string containing `\0`"]
 pub fn foo() {}