mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Remove util::debug_utils
This commit is contained in:
parent
e77efb93c1
commit
b6ca1b9b3b
2 changed files with 0 additions and 34 deletions
|
@ -1,33 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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::{self, Write};
|
|
||||||
use std::mem;
|
|
||||||
use std::mem::size_of;
|
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
fn hexdump_slice(buf: &[u8]) {
|
|
||||||
let mut stderr = io::stderr();
|
|
||||||
stderr.write_all(b" ").unwrap();
|
|
||||||
for (i, &v) in buf.iter().enumerate() {
|
|
||||||
let output = format!("{:02X} ", v);
|
|
||||||
stderr.write_all(output.as_bytes()).unwrap();
|
|
||||||
match i % 16 {
|
|
||||||
15 => { stderr.write_all(b"\n ").unwrap(); },
|
|
||||||
7 => { stderr.write_all(b" ").unwrap(); },
|
|
||||||
_ => ()
|
|
||||||
}
|
|
||||||
stderr.flush().unwrap();
|
|
||||||
}
|
|
||||||
stderr.write_all(b"\n").unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn hexdump<T>(obj: &T) {
|
|
||||||
unsafe {
|
|
||||||
let buf: *const u8 = mem::transmute(obj);
|
|
||||||
debug!("dumping at {:p}", buf);
|
|
||||||
let from_buf = slice::from_raw_parts(buf, size_of::<T>());
|
|
||||||
hexdump_slice(from_buf);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -35,7 +35,6 @@ use std::sync::Arc;
|
||||||
|
|
||||||
pub mod basedir;
|
pub mod basedir;
|
||||||
pub mod cache;
|
pub mod cache;
|
||||||
#[allow(unsafe_code)] pub mod debug_utils;
|
|
||||||
pub mod geometry;
|
pub mod geometry;
|
||||||
#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod ipc;
|
#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod ipc;
|
||||||
#[allow(unsafe_code)] pub mod opts;
|
#[allow(unsafe_code)] pub mod opts;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue