Switched over substr and trim functions in str to be non-allocating, temporary renamed them to better track use-sites

This commit is contained in:
Marvin Löbel
2013-03-21 22:59:33 +01:00
parent ed25a674ac
commit ee2f3d9673
18 changed files with 130 additions and 124 deletions

View File

@@ -223,12 +223,12 @@ pub fn parse(s: &str) -> Option<Version> {
if ! str::is_ascii(s) {
return None;
}
let s = s.trim();
let s = s.trim_DBGBRWD();
let mut bad = false;
do bad_parse::cond.trap(|_| { debug!("bad"); bad = true }).in {
do io::with_str_reader(s) |rdr| {
let v = parse_reader(rdr);
if bad || v.to_str() != s {
if bad || v.to_str() != s.to_owned() {
None
} else {
Some(v)