about summary refs log tree commit diff
path: root/src/libextra/terminfo
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2013-06-11 13:10:37 +1000
committerHuon Wilson <dbau.pp+github@gmail.com>2013-06-12 12:21:04 +1000
commitefc71a8bdb28fba88d0cc8916b33838bf43b3a8d (patch)
treead0086d4319facd8da21583e19a952a01250bbbd /src/libextra/terminfo
parentba4a4778cc17c64c33a891a0d2565a1fb04ddffc (diff)
std: unify the str -> [u8] functions as 3 methods: .as_bytes() and .as_bytes_with_null[_consume]().
The first acts on &str and is not nul-terminated, the last two act on strings
that are always null terminated (&'static str, ~str and @str).
Diffstat (limited to 'src/libextra/terminfo')
-rw-r--r--src/libextra/terminfo/parm.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libextra/terminfo/parm.rs b/src/libextra/terminfo/parm.rs
index 4eb48f60a99..40191c89925 100644
--- a/src/libextra/terminfo/parm.rs
+++ b/src/libextra/terminfo/parm.rs
@@ -85,11 +85,14 @@ pub fn expand(cap: &[u8], params: &mut [Param], sta: &mut [Param], dyn: &mut [Pa
                         _       => return Err(~"a non-char was used with %c")
                     },
                     's' => match stack.pop() {
-                        String(s) => output.push_all(s.to_bytes()),
+                        String(s) => output.push_all(s.as_bytes()),
                         _         => return Err(~"a non-str was used with %s")
                     },
                     'd' => match stack.pop() {
-                        Number(x) => output.push_all(x.to_str().to_bytes()),
+                        Number(x) => {
+                            let s = x.to_str();
+                            output.push_all(s.as_bytes())
+                        }
                         _         => return Err(~"a non-number was used with %d")
                     },
                     'p' => state = PushParam,