Skip to content

Commit 8903fdc

Browse files
committed
---
yaml --- r: 15458 b: refs/heads/try c: a1b305c h: refs/heads/master v: v3
1 parent d8f2882 commit 8903fdc

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: ea0063788bd3de6eeccdf575c3f6cc95d7a5d2c8
5+
refs/heads/try: a1b305c8e526700e3e16e51d576691ac4ebdc335
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/libcore/str.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ fn split_inner(s: str, sepfn: fn(cc: char) -> bool, count: uint,
445445
result
446446
}
447447

448-
// FIXME use Boyer-Moore
448+
// See Issue #1932 for why this is a naive search
449449
fn iter_matches(s: str, sep: str, f: fn(uint, uint)) {
450450
let sep_len = len(sep), l = len(s);
451451
assert sep_len > 0u;
@@ -581,7 +581,7 @@ pure fn le(&&a: str, &&b: str) -> bool { a <= b }
581581
#[doc = "String hash function"]
582582
fn hash(&&s: str) -> uint {
583583
// djb hash.
584-
// FIXME: replace with murmur.
584+
// FIXME: replace with murmur. (see #859 and #1616)
585585
let mut u: uint = 5381u;
586586
for each(s) {|c| u *= 33u; u += c as uint; }
587587
ret u;
@@ -1072,7 +1072,7 @@ or equal to `len(s)`.
10721072
"]
10731073
fn find_str_between(haystack: str, needle: str, start: uint, end:uint)
10741074
-> option<uint> {
1075-
// FIXME: Boyer-Moore should be significantly faster
1075+
// See Issue #1932 for why this is a naive search
10761076
assert end <= len(haystack);
10771077
let needle_len = len(needle);
10781078
if needle_len == 0u { ret some(start); }
@@ -1600,16 +1600,11 @@ fn capacity(&&s: str) -> uint unsafe {
16001600
#[doc = "Unsafe operations"]
16011601
mod unsafe {
16021602
export
1603-
// FIXME: stop exporting several of these
16041603
from_buf,
1605-
from_buf_len,
16061604
from_c_str,
1607-
from_c_str_len,
16081605
from_bytes,
1609-
from_byte,
16101606
slice_bytes,
16111607
push_byte,
1612-
push_bytes,
16131608
pop_byte,
16141609
shift_byte,
16151610
set_len;
@@ -1740,6 +1735,15 @@ mod unsafe {
17401735
let null = ptr::mut_offset(ptr::mut_addr_of((*repr).data), new_len);
17411736
*null = 0u8;
17421737
}
1738+
1739+
#[test]
1740+
fn test_from_buf_len() unsafe {
1741+
let a = [65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8];
1742+
let b = vec::unsafe::to_ptr(a);
1743+
let c = from_buf_len(b, 3u);
1744+
assert (c == "AAA");
1745+
}
1746+
17431747
}
17441748

17451749
#[doc = "Extension methods for strings"]
@@ -2439,14 +2443,6 @@ mod tests {
24392443
assert (c == "AAAAAAA");
24402444
}
24412445

2442-
#[test]
2443-
fn test_from_buf_len() unsafe {
2444-
let a = [65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8];
2445-
let b = vec::unsafe::to_ptr(a);
2446-
let c = unsafe::from_buf_len(b, 3u);
2447-
assert (c == "AAA");
2448-
}
2449-
24502446
#[test]
24512447
#[ignore(cfg(target_os = "win32"))]
24522448
#[should_fail]

0 commit comments

Comments
 (0)