diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-11-28 23:52:11 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-12-04 22:35:53 +1100 |
| commit | 9d64e46013096997627da62ecc65225bc22682e8 (patch) | |
| tree | fa20c8fd1d653acff5f996253d16103dd61addd9 /src/libextra/terminfo/parser/compiled.rs | |
| parent | 9635c763ba5edc8c8ea2868b895548b52f640e5a (diff) | |
std::str: remove from_utf8.
This function had type &[u8] -> ~str, i.e. it allocates a string internally, even though the non-allocating version that take &[u8] -> &str and ~[u8] -> ~str are all that is necessary in most circumstances.
Diffstat (limited to 'src/libextra/terminfo/parser/compiled.rs')
| -rw-r--r-- | src/libextra/terminfo/parser/compiled.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libextra/terminfo/parser/compiled.rs b/src/libextra/terminfo/parser/compiled.rs index af1532db935..bc997c5147d 100644 --- a/src/libextra/terminfo/parser/compiled.rs +++ b/src/libextra/terminfo/parser/compiled.rs @@ -215,7 +215,9 @@ pub fn parse(file: &mut io::Reader, return Err(~"incompatible file: more string offsets than expected"); } - let names_str = str::from_utf8(file.read_bytes(names_bytes as uint - 1)); // don't read NUL + // don't read NUL + let names_str = str::from_utf8_owned(file.read_bytes(names_bytes as uint - 1)); + let term_names: ~[~str] = names_str.split('|').map(|s| s.to_owned()).collect(); file.read_byte(); // consume NUL |
