summary refs log tree commit diff
path: root/src/libterm/terminfo/parser
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2014-03-26 09:24:16 -0700
committerSteven Fackler <sfackler@gmail.com>2014-04-06 15:39:56 -0700
commitd0e60b72ee3f5fb07b01143d82362cb42307f32d (patch)
treeed0161843da862f7b40a01b76a81ced97c1e67da /src/libterm/terminfo/parser
parent94a055c7295bd5822219b86243c2af6fff9d21d3 (diff)
downloadrust-d0e60b72ee3f5fb07b01143d82362cb42307f32d.tar.gz
rust-d0e60b72ee3f5fb07b01143d82362cb42307f32d.zip
De-~[] Reader and Writer
There's a little more allocation here and there now since
from_utf8_owned can't be used with Vec.
Diffstat (limited to 'src/libterm/terminfo/parser')
-rw-r--r--src/libterm/terminfo/parser/compiled.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs
index 6d87d91ffc0..37ef3c133a5 100644
--- a/src/libterm/terminfo/parser/compiled.rs
+++ b/src/libterm/terminfo/parser/compiled.rs
@@ -208,8 +208,8 @@ pub fn parse(file: &mut io::Reader,
 
     // don't read NUL
     let bytes = try!(file.read_exact(names_bytes as uint - 1));
-    let names_str = match str::from_utf8_owned(bytes) {
-        Some(s) => s, None => return Err(~"input not utf-8"),
+    let names_str = match str::from_utf8(bytes.as_slice()) {
+        Some(s) => s.to_owned(), None => return Err(~"input not utf-8"),
     };
 
     let term_names: Vec<~str> = names_str.split('|').map(|s| s.to_owned()).collect();