about summary refs log tree commit diff
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-09-18 10:54:43 -0700
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-09-26 22:20:39 -0700
commit4834661c66658196f5f4dd60b751aae2d0daf0ec (patch)
treee7777c49d85270b1d92de33a92e8923501fd70a3
parenta94158ce64524b7e21e6c8ec23a6b762d45926fb (diff)
std and rustc: Convert users of c_str to use .with_c_str
-rw-r--r--src/librustc/middle/trans/base.rs4
-rw-r--r--src/librustc/middle/trans/debuginfo.rs4
-rw-r--r--src/librustc/middle/trans/foreign.rs4
-rw-r--r--src/libstd/rt/crate_map.rs4
-rw-r--r--src/libstd/rt/logging.rs12
-rw-r--r--src/libstd/rt/uv/file.rs16
6 files changed, 22 insertions, 22 deletions
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 479f10a3b4a..bb793dd2155 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -524,13 +524,13 @@ pub fn set_always_inline(f: ValueRef) {
 }
 
 pub fn set_fixed_stack_segment(f: ValueRef) {
-    do "fixed-stack-segment".to_c_str().with_ref |buf| {
+    do "fixed-stack-segment".with_c_str |buf| {
         unsafe { llvm::LLVMAddFunctionAttrString(f, buf); }
     }
 }
 
 pub fn set_no_split_stack(f: ValueRef) {
-    do "no-split-stack".to_c_str().with_ref |buf| {
+    do "no-split-stack".with_c_str |buf| {
         unsafe { llvm::LLVMAddFunctionAttrString(f, buf); }
     }
 }
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index 91f6169b419..c36d427a06c 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -781,7 +781,7 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
 
                 let ident = special_idents::type_self;
 
-                let param_metadata = do token::ident_to_str(&ident).to_c_str().with_ref |name| {
+                let param_metadata = do token::ident_to_str(&ident).with_c_str |name| {
                     unsafe {
                         llvm::LLVMDIBuilderCreateTemplateTypeParameter(
                             DIB(cx),
@@ -819,7 +819,7 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
             // Again, only create type information if extra_debuginfo is enabled
             if cx.sess.opts.extra_debuginfo {
                 let actual_type_metadata = type_metadata(cx, actual_type, codemap::dummy_sp());
-                let param_metadata = do token::ident_to_str(&ident).to_c_str().with_ref |name| {
+                let param_metadata = do token::ident_to_str(&ident).with_c_str |name| {
                     unsafe {
                         llvm::LLVMDIBuilderCreateTemplateTypeParameter(
                             DIB(cx),
diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs
index b00d77d72dd..f28f5449e00 100644
--- a/src/librustc/middle/trans/foreign.rs
+++ b/src/librustc/middle/trans/foreign.rs
@@ -465,7 +465,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
         //     }
 
         let the_block =
-            "the block".to_c_str().with_ref(
+            "the block".with_c_str(
                 |s| llvm::LLVMAppendBasicBlockInContext(ccx.llcx, llwrapfn, s));
 
         let builder = ccx.builder.B;
@@ -519,7 +519,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
 
                 None => {
                     let slot = {
-                        "return_alloca".to_c_str().with_ref(
+                        "return_alloca".with_c_str(
                             |s| llvm::LLVMBuildAlloca(builder,
                                                       llrust_ret_ty.to_ref(),
                                                       s))
diff --git a/src/libstd/rt/crate_map.rs b/src/libstd/rt/crate_map.rs
index 57abb7560a1..94d37f67ba1 100644
--- a/src/libstd/rt/crate_map.rs
+++ b/src/libstd/rt/crate_map.rs
@@ -209,7 +209,7 @@ fn iter_crate_map_follow_children() {
         let child_crate1 = CrateMapT2 {
             version: 1,
             entries: vec::raw::to_ptr([
-                ModEntry { name: "t::f1".to_c_str().with_ref(|buf| buf), log_level: &mut 1},
+                ModEntry { name: "t::f1".with_c_str(|buf| buf), log_level: &mut 1},
                 ModEntry { name: ptr::null(), log_level: ptr::mut_null()}
             ]),
             children: [&child_crate2 as *CrateMap, ptr::null()]
@@ -219,7 +219,7 @@ fn iter_crate_map_follow_children() {
         let root_crate = CrateMapT2 {
             version: 1,
             entries: vec::raw::to_ptr([
-                ModEntry { name: "t::f1".to_c_str().with_ref(|buf| buf), log_level: &mut 0},
+                ModEntry { name: "t::f1".with_c_str(|buf| buf), log_level: &mut 0},
                 ModEntry { name: ptr::null(), log_level: ptr::mut_null()}
             ]),
             children: [child_crate1_ptr, ptr::null()]
diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs
index cfbc53ad34e..abbcd27e8ca 100644
--- a/src/libstd/rt/logging.rs
+++ b/src/libstd/rt/logging.rs
@@ -294,7 +294,7 @@ fn update_entry_match_full_path() {
                  LogDirective {name: Some(~"crate2"), level: 3}];
     let level = &mut 0;
     unsafe {
-        do "crate1::mod1".to_c_str().with_ref |ptr| {
+        do "crate1::mod1".with_c_str |ptr| {
             let entry= &ModEntry {name: ptr, log_level: level};
             let m = update_entry(dirs, transmute(entry));
             assert!(*entry.log_level == 2);
@@ -310,7 +310,7 @@ fn update_entry_no_match() {
                  LogDirective {name: Some(~"crate2"), level: 3}];
     let level = &mut 0;
     unsafe {
-        do "crate3::mod1".to_c_str().with_ref |ptr| {
+        do "crate3::mod1".with_c_str |ptr| {
             let entry= &ModEntry {name: ptr, log_level: level};
             let m = update_entry(dirs, transmute(entry));
             assert!(*entry.log_level == DEFAULT_LOG_LEVEL);
@@ -326,7 +326,7 @@ fn update_entry_match_beginning() {
                  LogDirective {name: Some(~"crate2"), level: 3}];
     let level = &mut 0;
     unsafe {
-        do "crate2::mod1".to_c_str().with_ref |ptr| {
+        do "crate2::mod1".with_c_str |ptr| {
             let entry= &ModEntry {name: ptr, log_level: level};
             let m = update_entry(dirs, transmute(entry));
             assert!(*entry.log_level == 3);
@@ -343,7 +343,7 @@ fn update_entry_match_beginning_longest_match() {
                  LogDirective {name: Some(~"crate2::mod"), level: 4}];
     let level = &mut 0;
     unsafe {
-        do "crate2::mod1".to_c_str().with_ref |ptr| {
+        do "crate2::mod1".with_c_str |ptr| {
             let entry = &ModEntry {name: ptr, log_level: level};
             let m = update_entry(dirs, transmute(entry));
             assert!(*entry.log_level == 4);
@@ -360,13 +360,13 @@ fn update_entry_match_default() {
                 ];
     let level = &mut 0;
     unsafe {
-        do "crate1::mod1".to_c_str().with_ref |ptr| {
+        do "crate1::mod1".with_c_str |ptr| {
             let entry= &ModEntry {name: ptr, log_level: level};
             let m = update_entry(dirs, transmute(entry));
             assert!(*entry.log_level == 2);
             assert!(m == 1);
         }
-        do "crate2::mod2".to_c_str().with_ref |ptr| {
+        do "crate2::mod2".with_c_str |ptr| {
             let entry= &ModEntry {name: ptr, log_level: level};
             let m = update_entry(dirs, transmute(entry));
             assert!(*entry.log_level == 3);
diff --git a/src/libstd/rt/uv/file.rs b/src/libstd/rt/uv/file.rs
index 54cb40c9873..fcd8800fadd 100644
--- a/src/libstd/rt/uv/file.rs
+++ b/src/libstd/rt/uv/file.rs
@@ -43,7 +43,7 @@ impl FsRequest {
             me.req_boilerplate(Some(cb))
         };
         path.path_as_str(|p| {
-            p.to_c_str().with_ref(|p| unsafe {
+            p.with_c_str(|p| unsafe {
             uvll::fs_open(loop_.native_handle(),
                           self.native_handle(), p, flags, mode, complete_cb_ptr)
             })
@@ -57,7 +57,7 @@ impl FsRequest {
             me.req_boilerplate(None)
         };
         let result = path.path_as_str(|p| {
-            p.to_c_str().with_ref(|p| unsafe {
+            p.with_c_str(|p| unsafe {
             uvll::fs_open(loop_.native_handle(),
                     self.native_handle(), p, flags, mode, complete_cb_ptr)
             })
@@ -71,7 +71,7 @@ impl FsRequest {
             me.req_boilerplate(Some(cb))
         };
         path.path_as_str(|p| {
-            p.to_c_str().with_ref(|p| unsafe {
+            p.with_c_str(|p| unsafe {
                 uvll::fs_unlink(loop_.native_handle(),
                               self.native_handle(), p, complete_cb_ptr)
             })
@@ -85,7 +85,7 @@ impl FsRequest {
             me.req_boilerplate(None)
         };
         let result = path.path_as_str(|p| {
-            p.to_c_str().with_ref(|p| unsafe {
+            p.with_c_str(|p| unsafe {
                 uvll::fs_unlink(loop_.native_handle(),
                               self.native_handle(), p, complete_cb_ptr)
             })
@@ -99,7 +99,7 @@ impl FsRequest {
             me.req_boilerplate(Some(cb))
         };
         path.path_as_str(|p| {
-            p.to_c_str().with_ref(|p| unsafe {
+            p.with_c_str(|p| unsafe {
                 uvll::fs_stat(loop_.native_handle(),
                               self.native_handle(), p, complete_cb_ptr)
             })
@@ -192,7 +192,7 @@ impl FsRequest {
             me.req_boilerplate(Some(cb))
         };
         path.path_as_str(|p| {
-            p.to_c_str().with_ref(|p| unsafe {
+            p.with_c_str(|p| unsafe {
             uvll::fs_mkdir(loop_.native_handle(),
                           self.native_handle(), p, mode, complete_cb_ptr)
             })
@@ -205,7 +205,7 @@ impl FsRequest {
             me.req_boilerplate(Some(cb))
         };
         path.path_as_str(|p| {
-            p.to_c_str().with_ref(|p| unsafe {
+            p.with_c_str(|p| unsafe {
             uvll::fs_rmdir(loop_.native_handle(),
                           self.native_handle(), p, complete_cb_ptr)
             })
@@ -219,7 +219,7 @@ impl FsRequest {
             me.req_boilerplate(Some(cb))
         };
         path.path_as_str(|p| {
-            p.to_c_str().with_ref(|p| unsafe {
+            p.with_c_str(|p| unsafe {
             uvll::fs_readdir(loop_.native_handle(),
                           self.native_handle(), p, flags, complete_cb_ptr)
             })