diff options
| author | bors <bors@rust-lang.org> | 2014-03-29 18:56:36 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-29 18:56:36 -0700 |
| commit | d79fbba0db84b2d27440f8feba715dffd3aeaa01 (patch) | |
| tree | d5f8701b97fcf2fc596a52215ad96462c1eb981e /src/libnative | |
| parent | 86890b9e7c5db28ac2da5cd63d1a51d63a5e6bec (diff) | |
| parent | c356e3ba6a12c3294a9a428ef9120cff9306bf4b (diff) | |
| download | rust-d79fbba0db84b2d27440f8feba715dffd3aeaa01.tar.gz rust-d79fbba0db84b2d27440f8feba715dffd3aeaa01.zip | |
auto merge of #13203 : Kimundi/rust/de-map-vec3, r=cmr
They required unnecessary temporaries, are replaced with iterators, and would conflict with a possible future `Iterable` trait.
Diffstat (limited to 'src/libnative')
| -rw-r--r-- | src/libnative/io/process.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs index 463f9f8bedd..b0f2495e98c 100644 --- a/src/libnative/io/process.rs +++ b/src/libnative/io/process.rs @@ -597,7 +597,7 @@ fn with_argv<T>(prog: &str, args: &[~str], cb: proc:(**libc::c_char) -> T) -> T // Next, convert each of the byte strings into a pointer. This is // technically unsafe as the caller could leak these pointers out of our // scope. - let mut ptrs = tmps.map(|tmp| tmp.with_ref(|buf| buf)); + let mut ptrs: Vec<_> = tmps.iter().map(|tmp| tmp.with_ref(|buf| buf)).collect(); // Finally, make sure we add a null pointer. ptrs.push(ptr::null()); @@ -622,7 +622,9 @@ fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: proc:(*c_void) -> T) -> T { } // Once again, this is unsafe. - let mut ptrs = tmps.map(|tmp| tmp.with_ref(|buf| buf)); + let mut ptrs: Vec<*libc::c_char> = tmps.iter() + .map(|tmp| tmp.with_ref(|buf| buf)) + .collect(); ptrs.push(ptr::null()); cb(ptrs.as_ptr() as *c_void) |
