about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-08-03 17:13:14 -0700
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-08-04 14:13:17 -0700
commit3102b1797e24b9dd8eef2f68a74ec83749d7b53d (patch)
treec68578899941c134b1bc4e59999d5a40047f89f0 /src/libstd/rt
parent0512475fdab549182e73a42c2cd02df0cb710ebf (diff)
downloadrust-3102b1797e24b9dd8eef2f68a74ec83749d7b53d.tar.gz
rust-3102b1797e24b9dd8eef2f68a74ec83749d7b53d.zip
std: replace str::as_c_str with std::c_str
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/borrowck.rs7
-rw-r--r--src/libstd/rt/logging.rs4
-rw-r--r--src/libstd/rt/uv/uvio.rs26
-rw-r--r--src/libstd/rt/uv/uvll.rs5
4 files changed, 22 insertions, 20 deletions
diff --git a/src/libstd/rt/borrowck.rs b/src/libstd/rt/borrowck.rs
index 4a6a9585b93..3a51fd032c0 100644
--- a/src/libstd/rt/borrowck.rs
+++ b/src/libstd/rt/borrowck.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use c_str::ToCStr;
 use cast::transmute;
 use libc::{c_char, c_void, size_t, STDERR_FILENO};
 use io;
@@ -76,7 +77,7 @@ unsafe fn fail_borrowed(box: *mut raw::Box<()>, file: *c_char, line: size_t) {
     match try_take_task_borrow_list() {
         None => { // not recording borrows
             let msg = "borrowed";
-            do msg.as_c_str |msg_p| {
+            do msg.to_c_str().with_ref |msg_p| {
                 sys::begin_unwind_(msg_p, file, line);
             }
         }
@@ -92,7 +93,7 @@ unsafe fn fail_borrowed(box: *mut raw::Box<()>, file: *c_char, line: size_t) {
                     sep = " and at ";
                 }
             }
-            do msg.as_c_str |msg_p| {
+            do msg.to_c_str().with_ref |msg_p| {
                 sys::begin_unwind_(msg_p, file, line)
             }
         }
@@ -231,7 +232,7 @@ pub unsafe fn unrecord_borrow(a: *u8, old_ref_count: uint,
             let br = borrow_list.pop();
             if br.box != a || br.file != file || br.line != line {
                 let err = fmt!("wrong borrow found, br=%?", br);
-                do err.as_c_str |msg_p| {
+                do err.to_c_str().with_ref |msg_p| {
                     sys::begin_unwind_(msg_p, file, line)
                 }
             }
diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs
index 11d11daebc2..76619704bee 100644
--- a/src/libstd/rt/logging.rs
+++ b/src/libstd/rt/logging.rs
@@ -45,15 +45,15 @@ impl Logger for StdErrLogger {
 /// Configure logging by traversing the crate map and setting the
 /// per-module global logging flags based on the logging spec
 pub fn init(crate_map: *u8) {
+    use c_str::ToCStr;
     use os;
-    use str::StrSlice;
     use ptr;
     use option::{Some, None};
 
     let log_spec = os::getenv("RUST_LOG");
     match log_spec {
         Some(spec) => {
-            do spec.as_c_str |buf| {
+            do spec.to_c_str().with_ref |buf| {
                 unsafe { rust_update_log_settings(crate_map, buf) }
             }
         }
diff --git a/src/libstd/rt/uv/uvio.rs b/src/libstd/rt/uv/uvio.rs
index e15e3adb8c9..071a90f4a83 100644
--- a/src/libstd/rt/uv/uvio.rs
+++ b/src/libstd/rt/uv/uvio.rs
@@ -8,26 +8,26 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use option::*;
-use result::*;
-use ops::Drop;
-use cell::Cell;
-use cast;
+use c_str::ToCStr;
 use cast::transmute;
+use cast;
+use cell::Cell;
 use clone::Clone;
 use libc::{c_int, c_uint, c_void};
+use ops::Drop;
+use option::*;
 use ptr;
+use result::*;
 use rt::io::IoError;
 use rt::io::net::ip::{IpAddr, Ipv4, Ipv6};
-use rt::uv::*;
-use rt::uv::idle::IdleWatcher;
-use rt::uv::net::{UvIpv4, UvIpv6};
+use rt::io::{standard_error, OtherIoError};
+use rt::local::Local;
 use rt::rtio::*;
 use rt::sched::Scheduler;
-use rt::io::{standard_error, OtherIoError};
 use rt::tube::Tube;
-use rt::local::Local;
-use str::StrSlice;
+use rt::uv::*;
+use rt::uv::idle::IdleWatcher;
+use rt::uv::net::{UvIpv4, UvIpv6};
 use unstable::sync::Exclusive;
 
 #[cfg(test)] use container::Container;
@@ -663,7 +663,7 @@ impl RtioUdpSocket for UvUdpSocket {
         };
 
         let r = unsafe {
-            do ip_str.as_c_str |m_addr| {
+            do ip_str.to_c_str().with_ref |m_addr| {
                 uvll::udp_set_membership(self.native_handle(), m_addr,
                                          ptr::null(), uvll::UV_JOIN_GROUP)
             }
@@ -686,7 +686,7 @@ impl RtioUdpSocket for UvUdpSocket {
         };
 
         let r = unsafe {
-            do ip_str.as_c_str |m_addr| {
+            do ip_str.to_c_str().with_ref |m_addr| {
                 uvll::udp_set_membership(self.native_handle(), m_addr,
                                          ptr::null(), uvll::UV_LEAVE_GROUP)
             }
diff --git a/src/libstd/rt/uv/uvll.rs b/src/libstd/rt/uv/uvll.rs
index 07264839c35..bd2d28f8642 100644
--- a/src/libstd/rt/uv/uvll.rs
+++ b/src/libstd/rt/uv/uvll.rs
@@ -29,6 +29,7 @@
 
 #[allow(non_camel_case_types)]; // C types
 
+use c_str::ToCStr;
 use libc::{size_t, c_int, c_uint, c_void, c_char, uintptr_t};
 use libc::{malloc, free};
 use libc;
@@ -372,12 +373,12 @@ pub unsafe fn is_ip6_addr(addr: *sockaddr) -> bool {
 }
 
 pub unsafe fn malloc_ip4_addr(ip: &str, port: int) -> *sockaddr_in {
-    do ip.as_c_str |ip_buf| {
+    do ip.to_c_str().with_ref |ip_buf| {
         rust_uv_ip4_addrp(ip_buf as *u8, port as libc::c_int)
     }
 }
 pub unsafe fn malloc_ip6_addr(ip: &str, port: int) -> *sockaddr_in6 {
-    do ip.as_c_str |ip_buf| {
+    do ip.to_c_str().with_ref |ip_buf| {
         rust_uv_ip6_addrp(ip_buf as *u8, port as libc::c_int)
     }
 }