@@ -445,7 +445,7 @@ fn split_inner(s: str, sepfn: fn(cc: char) -> bool, count: uint,
445
445
result
446
446
}
447
447
448
- // FIXME use Boyer-Moore
448
+ // See Issue #1932 for why this is a naive search
449
449
fn iter_matches ( s : str , sep : str , f : fn ( uint , uint ) ) {
450
450
let sep_len = len ( sep) , l = len ( s) ;
451
451
assert sep_len > 0 u;
@@ -581,7 +581,7 @@ pure fn le(&&a: str, &&b: str) -> bool { a <= b }
581
581
#[ doc = "String hash function" ]
582
582
fn hash ( & & s: str ) -> uint {
583
583
// djb hash.
584
- // FIXME: replace with murmur.
584
+ // FIXME: replace with murmur. (see #859 and #1616)
585
585
let mut u: uint = 5381 u;
586
586
for each( s) { |c| u *= 33 u; u += c as uint ; }
587
587
ret u;
@@ -1072,7 +1072,7 @@ or equal to `len(s)`.
1072
1072
" ]
1073
1073
fn find_str_between ( haystack : str , needle : str , start : uint , end : uint )
1074
1074
-> option < uint > {
1075
- // FIXME: Boyer-Moore should be significantly faster
1075
+ // See Issue #1932 for why this is a naive search
1076
1076
assert end <= len ( haystack) ;
1077
1077
let needle_len = len ( needle) ;
1078
1078
if needle_len == 0 u { ret some ( start) ; }
@@ -1600,16 +1600,11 @@ fn capacity(&&s: str) -> uint unsafe {
1600
1600
#[ doc = "Unsafe operations" ]
1601
1601
mod unsafe {
1602
1602
export
1603
- // FIXME: stop exporting several of these
1604
1603
from_buf,
1605
- from_buf_len,
1606
1604
from_c_str,
1607
- from_c_str_len,
1608
1605
from_bytes,
1609
- from_byte,
1610
1606
slice_bytes,
1611
1607
push_byte,
1612
- push_bytes,
1613
1608
pop_byte,
1614
1609
shift_byte,
1615
1610
set_len;
@@ -1740,6 +1735,15 @@ mod unsafe {
1740
1735
let null = ptr:: mut_offset ( ptr:: mut_addr_of ( ( * repr) . data ) , new_len) ;
1741
1736
* null = 0u8 ;
1742
1737
}
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, 3 u) ;
1744
+ assert ( c == "AAA" ) ;
1745
+ }
1746
+
1743
1747
}
1744
1748
1745
1749
#[ doc = "Extension methods for strings" ]
@@ -2439,14 +2443,6 @@ mod tests {
2439
2443
assert ( c == "AAAAAAA" ) ;
2440
2444
}
2441
2445
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, 3 u) ;
2447
- assert ( c == "AAA" ) ;
2448
- }
2449
-
2450
2446
#[ test]
2451
2447
#[ ignore( cfg( target_os = "win32" ) ) ]
2452
2448
#[ should_fail]
0 commit comments