diff options
author | bors-servo <release+servo@mozilla.com> | 2013-10-31 16:34:14 -0700 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2013-10-31 16:34:14 -0700 |
commit | 352acbb8335fcf78f2d62dc781fa9d86b9368f9c (patch) | |
tree | c27c2d41cbffc19415b4d183367568ff1682b688 /src/components/util/debug.rs | |
parent | 041f3a8b06e3f29e99464af752cad8f1a7e93540 (diff) | |
parent | aaf96b600363ec6d2a4d23cf318b47d9bbb743b5 (diff) | |
download | servo-352acbb8335fcf78f2d62dc781fa9d86b9368f9c.tar.gz servo-352acbb8335fcf78f2d62dc781fa9d86b9368f9c.zip |
auto merge of #1163 : metajack/servo/kmc-rust-upgrade, r=kmcallister
Most work courtesy of @kmcallister.
I already reviewed Keegan's work, so just the last two commits need attention.
Diffstat (limited to 'src/components/util/debug.rs')
-rw-r--r-- | src/components/util/debug.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/components/util/debug.rs b/src/components/util/debug.rs index 67a1d7d5f21..5c9aa700d5b 100644 --- a/src/components/util/debug.rs +++ b/src/components/util/debug.rs @@ -2,30 +2,32 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use std::io; +use std::rt::io; +use std::rt::io::Writer; use std::vec::raw::buf_as_slice; use std::cast::transmute; use std::mem::size_of; fn hexdump_slice(buf: &[u8]) { - let stderr = io::stderr(); - stderr.write_str(" "); + let mut stderr = io::stderr(); + stderr.write(bytes!(" ")); for (i, &v) in buf.iter().enumerate() { - stderr.write_str(fmt!("%02X ", v as uint)); + let output = format!("{:02X} ", v as uint); + stderr.write(output.as_bytes()); match i % 16 { - 15 => stderr.write_str("\n "), - 7 => stderr.write_str(" "), + 15 => stderr.write(bytes!("\n ")), + 7 => stderr.write(bytes!(" ")), _ => () } stderr.flush(); } - stderr.write_char('\n'); + stderr.write(bytes!("\n")); } pub fn hexdump<T>(obj: &T) { unsafe { let buf: *u8 = transmute(obj); - debug!("dumping at %p", buf); + debug!("dumping at {:p}", buf); buf_as_slice(buf, size_of::<T>(), hexdump_slice); } } |