From 651e63cc5c2b90204e8cd9d263da567fe2a66fbf Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Fri, 14 Sep 2012 09:51:24 -0700 Subject: [PATCH] libcore: rename *flate_buf to *flate_bytes (#3444) --- src/libcore/flate.rs | 14 +++++++------- src/rustc/metadata/encoder.rs | 2 +- src/rustc/metadata/loader.rs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index 836ffabd0fc3..234f2730233c 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -18,8 +18,8 @@ const lz_fast : c_int = 0x1; // LZ with only one probe const lz_norm : c_int = 0x80; // LZ with 128 probes, "normal" const lz_best : c_int = 0xfff; // LZ with 4095 probes, "best" -fn deflate_buf(buf: &[const u8]) -> ~[u8] { - do vec::as_const_buf(buf) |b, len| { +fn deflate_bytes(bytes: &[const u8]) -> ~[u8] { + do vec::as_const_buf(bytes) |b, len| { unsafe { let mut outsz : size_t = 0; let res = @@ -36,8 +36,8 @@ fn deflate_buf(buf: &[const u8]) -> ~[u8] { } } -fn inflate_buf(buf: &[const u8]) -> ~[u8] { - do vec::as_const_buf(buf) |b, len| { +fn inflate_bytes(bytes: &[const u8]) -> ~[u8] { + do vec::as_const_buf(bytes) |b, len| { unsafe { let mut outsz : size_t = 0; let res = @@ -69,11 +69,11 @@ fn test_flate_round_trip() { } debug!("de/inflate of %u bytes of random word-sequences", in.len()); - let cmp = flate::deflate_buf(in); - let out = flate::inflate_buf(cmp); + let cmp = flate::deflate_bytes(in); + let out = flate::inflate_bytes(cmp); debug!("%u bytes deflated to %u (%.1f%% size)", in.len(), cmp.len(), 100.0 * ((cmp.len() as float) / (in.len() as float))); assert(in == out); } -} \ No newline at end of file +} diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 68278c6deb7e..8994cac35d2f 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -1178,7 +1178,7 @@ fn encode_metadata(parms: encode_parms, crate: @crate) -> ~[u8] { (do str::as_bytes(~"rust\x00\x00\x00\x01") |bytes| { vec::slice(bytes, 0, 8) - }) + flate::deflate_buf(io::mem_buffer_buf(buf)) + }) + flate::deflate_bytes(io::mem_buffer_buf(buf)) } // Get the encoded string for a type diff --git a/src/rustc/metadata/loader.rs b/src/rustc/metadata/loader.rs index e12d158dd8ba..348e4f0bfc1f 100644 --- a/src/rustc/metadata/loader.rs +++ b/src/rustc/metadata/loader.rs @@ -202,8 +202,8 @@ fn get_metadata_section(os: os, let cvbuf1 = ptr::offset(cvbuf, vlen); debug!("inflating %u bytes of compressed metadata", csz - vlen); - do vec::raw::form_slice(cvbuf1, csz-vlen) |buf| { - let inflated = flate::inflate_buf(buf); + do vec::raw::form_slice(cvbuf1, csz-vlen) |bytes| { + let inflated = flate::inflate_bytes(bytes); found = move Some(@(move inflated)); } if found != None {