Skip to content

Commit e249c5a

Browse files
Replace uses of std::vec::raw::to_ptr() and to_mut_ptr()
See: * rust-lang/rust#10984 - Some general clean-up of std::vec::raw * rust-lang/rust@164f7a2 - std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut [].
1 parent 15d179c commit e249c5a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/pcre/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl Pcre {
396396

397397
unsafe {
398398
subject.with_c_str_unchecked(|subject_c_str| -> Option<Match<'a>> {
399-
let rc = detail::pcre_exec(self.code, self.extra, subject_c_str, subject.len() as c_int, startoffset as c_int, options, vec::raw::to_mut_ptr(ovector), ovecsize as c_int);
399+
let rc = detail::pcre_exec(self.code, self.extra, subject_c_str, subject.len() as c_int, startoffset as c_int, options, ovector.as_mut_ptr(), ovecsize as c_int);
400400
if rc >= 0 {
401401
Some(Match {
402402
subject: subject,
@@ -612,7 +612,7 @@ impl<'a> Iterator<Match<'a>> for MatchIterator<'a> {
612612
fn next(&mut self) -> Option<Match<'a>> {
613613
unsafe {
614614
self.subject_cstring.with_ref(|subject_c_str| -> Option<Match<'a>> {
615-
let rc = detail::pcre_exec(self.code, self.extra, subject_c_str, self.subject.len() as c_int, self.offset, &self.options, vec::raw::to_mut_ptr(self.ovector), self.ovector.len() as c_int);
615+
let rc = detail::pcre_exec(self.code, self.extra, subject_c_str, self.subject.len() as c_int, self.offset, &self.options, self.ovector.as_mut_ptr(), self.ovector.len() as c_int);
616616
if rc >= 0 {
617617
// Update the iterator state.
618618
self.offset = self.ovector[1];

src/pcre/pkg.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use std::option::{Option};
2121
use std::os;
2222
use std::run;
2323
use std::str;
24-
use std::vec;
2524

2625
struct Version {
2726
major: uint,
@@ -73,7 +72,7 @@ fn do_install(args: ~[~str]) {
7372
if !pcre_config_output.status.success() {
7473
fail!("Package script error: `pcre-config` failed");
7574
}
76-
let output_ptr = vec::raw::to_ptr(pcre_config_output.output);
75+
let output_ptr = pcre_config_output.output.as_ptr();
7776
let output_len = pcre_config_output.output.len();
7877
let libs_str = unsafe { str::raw::from_buf_len(output_ptr, output_len) };
7978
os::setenv("PCRE_LIBS", libs_str);
@@ -153,7 +152,7 @@ fn main () \\{
153152
let ovecsize = 1 * 3;
154153
let mut ovector: ~[c_int] = vec::from_elem(ovecsize, 0 as c_int);
155154
version_str.with_c_str_unchecked(|version_c_str| \\{
156-
let rc = pcre_exec(code, ptr::null(), version_c_str, version_str.len() as c_int, 0, 0, vec::raw::to_mut_ptr(ovector), ovecsize as c_int);
155+
let rc = pcre_exec(code, ptr::null(), version_c_str, version_str.len() as c_int, 0, 0, ovector.as_mut_ptr(), ovecsize as c_int);
157156
if rc < 0 \\{
158157
fail!(\"pcre_exec() failed\");
159158
\\}
@@ -184,7 +183,7 @@ fn main () \\{
184183
}
185184
cd(&workspace_path);
186185

187-
let output_ptr = vec::raw::to_ptr(version_check_output.output);
186+
let output_ptr = version_check_output.output.as_ptr();
188187
let output_len = version_check_output.output.len();
189188
let output_str = unsafe { str::raw::from_buf_len(output_ptr, output_len) };
190189

0 commit comments

Comments
 (0)