std: win32 os::env() str parsing to str::raw::from_c_multistring + test
This commit is contained in:
@@ -196,16 +196,7 @@ pub fn env() -> ~[(~str,~str)] {
|
||||
if (ch as uint == 0) {
|
||||
fail!("os::env() failure getting env string from OS: %s", os::last_os_error());
|
||||
}
|
||||
let mut curr_ptr: uint = ch as uint;
|
||||
let mut result = ~[];
|
||||
while(*(curr_ptr as *libc::c_char) != 0 as libc::c_char) {
|
||||
let env_pair = str::raw::from_c_str(
|
||||
curr_ptr as *libc::c_char);
|
||||
result.push(env_pair);
|
||||
curr_ptr +=
|
||||
libc::strlen(curr_ptr as *libc::c_char) as uint
|
||||
+ 1;
|
||||
}
|
||||
result = unsafe { str::raw::from_c_multistring(ch as *libc::c_char) };
|
||||
FreeEnvironmentStringsA(ch);
|
||||
result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user