about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLenny222 <github@kudling.de>2012-01-03 19:08:13 +0100
committerMarijn Haverbeke <marijnh@gmail.com>2012-01-04 09:33:07 +0100
commitd1ffe5034b341a9a522c01705cafdb19bac9cedb (patch)
tree3f9a1b4110b5010e7c6e8d82d38e642831be989f /src
parentdd284eb396d802646106bdb15f474ebc10a9dfbb (diff)
downloadrust-d1ffe5034b341a9a522c01705cafdb19bac9cedb.tar.gz
rust-d1ffe5034b341a9a522c01705cafdb19bac9cedb.zip
"str": rename "str_from_cstr" to "from_cstr" (analogous to the other "from_*")
Diffstat (limited to 'src')
-rw-r--r--src/comp/back/link.rs2
-rw-r--r--src/comp/metadata/creader.rs2
-rw-r--r--src/libcore/str.rs6
-rw-r--r--src/libstd/generic_os.rs2
-rw-r--r--src/test/stdtest/str.rs6
5 files changed, 9 insertions, 9 deletions
diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs
index 86974f3f3be..8950618c2e6 100644
--- a/src/comp/back/link.rs
+++ b/src/comp/back/link.rs
@@ -34,7 +34,7 @@ fn llvm_err(sess: session::session, msg: str) unsafe {
     let buf = llvm::LLVMRustGetLastError();
     if buf == ptr::null() {
         sess.fatal(msg);
-    } else { sess.fatal(msg + ": " + str::str_from_cstr(buf)); }
+    } else { sess.fatal(msg + ": " + str::from_cstr(buf)); }
 }
 
 fn load_intrinsics_bc(sess: session::session) -> option::t<ModuleRef> {
diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs
index 2536e2efcb5..21ead604d31 100644
--- a/src/comp/metadata/creader.rs
+++ b/src/comp/metadata/creader.rs
@@ -216,7 +216,7 @@ fn get_metadata_section(sess: session::session,
     let si = mk_section_iter(of.llof);
     while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False {
         let name_buf = llvm::LLVMGetSectionName(si.llsi);
-        let name = unsafe { str::str_from_cstr(name_buf) };
+        let name = unsafe { str::from_cstr(name_buf) };
         if str::eq(name, sess.get_targ_cfg().target_strs.meta_sect_name) {
             let cbuf = llvm::LLVMGetSectionContents(si.llsi);
             let csz = llvm::LLVMGetSectionSize(si.llsi);
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 1872d0ae674..cba9b11cb3d 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -12,7 +12,7 @@ export eq, lteq, hash, is_empty, is_not_empty, is_whitespace, byte_len,
        push_char, is_utf8, from_chars, to_chars, char_len, char_len_range,
        char_at, bytes, is_ascii, shift_byte, pop_byte,
        unsafe_from_byte, unsafe_from_bytes, from_char, char_range_at,
-       str_from_cstr, sbuf, as_buf, push_byte, utf8_char_width, safe_slice,
+       from_cstr, sbuf, as_buf, push_byte, utf8_char_width, safe_slice,
        contains, iter_chars, loop_chars, loop_chars_sub,
        escape;
 
@@ -973,11 +973,11 @@ fn as_buf<T>(s: str, f: block(sbuf) -> T) -> T unsafe {
 }
 
 /*
-Function: str_from_cstr
+Function: from_cstr
 
 Create a Rust string from a null-terminated C string
 */
-unsafe fn str_from_cstr(cstr: sbuf) -> str {
+unsafe fn from_cstr(cstr: sbuf) -> str {
     let res = "";
     let start = cstr;
     let curr = start;
diff --git a/src/libstd/generic_os.rs b/src/libstd/generic_os.rs
index 6ffcb75c977..c1312ad4608 100644
--- a/src/libstd/generic_os.rs
+++ b/src/libstd/generic_os.rs
@@ -35,7 +35,7 @@ fn getenv(n: str) -> option::t<str> unsafe {
             option::none::<str>
         } else {
             let s = unsafe::reinterpret_cast(s);
-            option::some::<str>(str::str_from_cstr(s))
+            option::some::<str>(str::from_cstr(s))
         };
 }
 
diff --git a/src/test/stdtest/str.rs b/src/test/stdtest/str.rs
index c3f0e53bac5..39217fb8a8b 100644
--- a/src/test/stdtest/str.rs
+++ b/src/test/stdtest/str.rs
@@ -287,10 +287,10 @@ fn unsafe_from_bytes() {
 }
 
 #[test]
-fn str_from_cstr() unsafe {
+fn from_cstr() unsafe {
     let a = [65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8];
     let b = vec::to_ptr(a);
-    let c = str::str_from_cstr(b);
+    let c = str::from_cstr(b);
     assert (c == "AAAAAAA");
 }
 
@@ -312,7 +312,7 @@ fn as_buf_small() unsafe {
 fn as_buf2() unsafe {
     let s = "hello";
     let sb = str::as_buf(s, {|b| b });
-    let s_cstr = str::str_from_cstr(sb);
+    let s_cstr = str::from_cstr(sb);
     assert (str::eq(s_cstr, s));
 }