about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKevin Cantu <me@kevincantu.org>2012-02-23 01:45:59 -0800
committerMarijn Haverbeke <marijnh@gmail.com>2012-02-23 17:00:19 +0100
commitc3318f29fecca14100e5956a013ab50395b7ceda (patch)
tree2fb5ecf7c9a438e11011ec1f48a7ce6ae2eebfdc
parent7782f5d6926be7970ec474b74302f2298ceccd13 (diff)
downloadrust-c3318f29fecca14100e5956a013ab50395b7ceda.tar.gz
rust-c3318f29fecca14100e5956a013ab50395b7ceda.zip
(core::str) rename substr_len_bytes to substr_len, and delete unused byte_index[_from]
-rw-r--r--src/comp/syntax/codemap.rs2
-rw-r--r--src/libcore/str.rs23
-rw-r--r--src/libstd/rope.rs6
3 files changed, 5 insertions, 26 deletions
diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs
index c8b33687abe..0d1172b3502 100644
--- a/src/comp/syntax/codemap.rs
+++ b/src/comp/syntax/codemap.rs
@@ -171,7 +171,7 @@ fn lookup_byte_offset(cm: codemap::codemap, chpos: uint)
     let {fm,line} = lookup_line(cm,chpos,lookup);
     let line_offset = fm.lines[line].byte - fm.start_pos.byte;
     let col = chpos - fm.lines[line].ch;
-    let col_offset = str::substr_len_bytes(*fm.src, line_offset, col);
+    let col_offset = str::substr_len(*fm.src, line_offset, col);
     ret {fm: fm, pos: line_offset + col_offset};
 }
 
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index c199ead460f..e4df5bafad6 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -93,7 +93,7 @@ export
    // Misc
    // FIXME: perhaps some more of this section shouldn't be exported?
    is_utf8,
-   substr_len_bytes,
+   substr_len,
    substr_len_chars,
    utf8_char_width,
    char_range_at,
@@ -914,27 +914,6 @@ fn index_chars(ss: str, cc: char) -> option<uint> {
     ret none;
 }
 
-// Function: byte_index
-//
-// Returns the index of the first matching byte
-// (as option some/none)
-// FIXME: delete
-fn byte_index(s: str, b: u8) -> option<uint> {
-    byte_index_from(s, b, 0u, len(s))
-}
-
-// Function: byte_index_from
-//
-// Returns the index of the first matching byte within the range [`start`,
-// `end`).
-// (as option some/none)
-// FIXME: delete
-fn byte_index_from(s: str, b: u8, start: uint, end: uint) -> option<uint> {
-    assert end <= len(s);
-
-    str::as_bytes(s) { |v| vec::position_from(v, start, end) { |x| x == b } }
-}
-
 // Function: rindex
 //
 // Returns the byte index of the first matching char
diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs
index 81800afffa5..10144cc9731 100644
--- a/src/libstd/rope.rs
+++ b/src/libstd/rope.rs
@@ -795,7 +795,7 @@ mod node {
                     if i == 0u  { first_leaf_char_len }
                     else { hint_max_leaf_char_len };
                 let chunk_byte_len =
-                    str::substr_len_bytes(*str, offset, chunk_char_len);
+                    str::substr_len(*str, offset, chunk_char_len);
                 nodes[i] = @leaf({
                     byte_offset: offset,
                     byte_len:    chunk_byte_len,
@@ -1059,9 +1059,9 @@ mod node {
                     ret node;
                 }
                 let byte_offset =
-                    str::substr_len_bytes(*x.content, 0u, char_offset);
+                    str::substr_len(*x.content, 0u, char_offset);
                 let byte_len    =
-                    str::substr_len_bytes(*x.content, byte_offset, char_len);
+                    str::substr_len(*x.content, byte_offset, char_len);
                 ret @leaf({byte_offset: byte_offset,
                            byte_len:    byte_len,
                            char_len:    char_len,