Skip to content

Commit d0916c5

Browse files
Remove \0 printing
1 parent 26dd77f commit d0916c5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/librustdoc/html/markdown.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ extern {
530530
fn hoedown_buffer_new(unit: libc::size_t) -> *mut hoedown_buffer;
531531
fn hoedown_buffer_puts(b: *mut hoedown_buffer, c: *const libc::c_char);
532532
fn hoedown_buffer_free(b: *mut hoedown_buffer);
533-
fn hoedown_buffer_put(b: *mut hoedown_buffer, c: *const libc::c_char, len: libc::size_t);
533+
fn hoedown_buffer_put(b: *mut hoedown_buffer, c: *const u8, len: libc::size_t);
534534
}
535535

536536
impl hoedown_buffer {
@@ -620,7 +620,7 @@ pub fn render(w: &mut fmt::Formatter,
620620
Some("rust-example-rendered"),
621621
None,
622622
playground_button.as_ref().map(String::as_str)));
623-
hoedown_buffer_put(ob, s.as_ptr() as *const libc::c_char, s.len());
623+
hoedown_buffer_put(ob, s.as_ptr(), s.len());
624624
})
625625
}
626626
}
@@ -680,7 +680,7 @@ pub fn render(w: &mut fmt::Formatter,
680680
<a href='#{id}'>{sec}{}</a></h{lvl}>",
681681
s, lvl = level, id = id, sec = sec);
682682

683-
unsafe { hoedown_buffer_put(ob, text.as_ptr() as *const libc::c_char, text.len()); }
683+
unsafe { hoedown_buffer_put(ob, text.as_ptr(), text.len()); }
684684
}
685685

686686
extern fn codespan(
@@ -697,9 +697,9 @@ pub fn render(w: &mut fmt::Formatter,
697697
collapse_whitespace(s)
698698
};
699699

700-
let content = format!("<code>{}</code>", Escape(&content)).replace("\0", "\\0");
700+
let content = format!("<code>{}</code>", Escape(&content));
701701
unsafe {
702-
hoedown_buffer_put(ob, content.as_ptr() as *const libc::c_char, content.len());
702+
hoedown_buffer_put(ob, content.as_ptr(), content.len());
703703
}
704704
// Return anything except 0, which would mean "also print the code span verbatim".
705705
1

src/test/rustdoc/nul-error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313

1414
#![crate_name = "foo"]
1515

16-
// @has foo/fn.foo.html '//code' '0'
16+
// @has foo/fn.foo.html '//code' ''
1717
#[doc = "Attempted to pass a string containing `\0`"]
1818
pub fn foo() {}

0 commit comments

Comments
 (0)