libstd: Implement StrBuf, a new string buffer type like Vec, and
port all code over to use it.
This commit is contained in:
committed by
Huon Wilson
parent
7fbcb400f0
commit
d8e45ea7c0
@@ -35,6 +35,7 @@ use std::cell::Cell;
|
||||
use std::{cmp, os, path};
|
||||
use std::io::fs;
|
||||
use std::path::is_sep;
|
||||
use std::strbuf::StrBuf;
|
||||
|
||||
/**
|
||||
* An iterator that yields Paths from the filesystem that match a particular
|
||||
@@ -308,7 +309,7 @@ impl Pattern {
|
||||
* match the input string and nothing else.
|
||||
*/
|
||||
pub fn escape(s: &str) -> ~str {
|
||||
let mut escaped = ~"";
|
||||
let mut escaped = StrBuf::new();
|
||||
for c in s.chars() {
|
||||
match c {
|
||||
// note that ! does not need escaping because it is only special inside brackets
|
||||
@@ -322,7 +323,7 @@ impl Pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
escaped
|
||||
escaped.into_owned()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user