@@ -2351,10 +2351,7 @@ pub mod raw {
23512351
23522352/// Operations on `[u8]`
23532353pub mod bytes {
2354- use libc;
2355- use num;
23562354 use vec:: raw;
2357- use vec;
23582355 use ptr;
23592356
23602357 /// A trait for operations on mutable operations on `[u8]`
@@ -2372,45 +2369,6 @@ pub mod bytes {
23722369 }
23732370 }
23742371
2375- /// Bytewise string comparison
2376- pub fn memcmp ( a : & ~[ u8 ] , b : & ~[ u8 ] ) -> int {
2377- let a_len = a. len ( ) ;
2378- let b_len = b. len ( ) ;
2379- let n = num:: min ( a_len, b_len) as libc:: size_t ;
2380- let r = unsafe {
2381- libc:: memcmp ( raw:: to_ptr ( * a) as * libc:: c_void ,
2382- raw:: to_ptr ( * b) as * libc:: c_void , n) as int
2383- } ;
2384-
2385- if r != 0 { r } else {
2386- if a_len == b_len {
2387- 0
2388- } else if a_len < b_len {
2389- -1
2390- } else {
2391- 1
2392- }
2393- }
2394- }
2395-
2396- /// Bytewise less than or equal
2397- pub fn lt ( a : & ~[ u8 ] , b : & ~[ u8 ] ) -> bool { memcmp ( a, b) < 0 }
2398-
2399- /// Bytewise less than or equal
2400- pub fn le ( a : & ~[ u8 ] , b : & ~[ u8 ] ) -> bool { memcmp ( a, b) <= 0 }
2401-
2402- /// Bytewise equality
2403- pub fn eq ( a : & ~[ u8 ] , b : & ~[ u8 ] ) -> bool { memcmp ( a, b) == 0 }
2404-
2405- /// Bytewise inequality
2406- pub fn ne ( a : & ~[ u8 ] , b : & ~[ u8 ] ) -> bool { memcmp ( a, b) != 0 }
2407-
2408- /// Bytewise greater than or equal
2409- pub fn ge ( a : & ~[ u8 ] , b : & ~[ u8 ] ) -> bool { memcmp ( a, b) >= 0 }
2410-
2411- /// Bytewise greater than
2412- pub fn gt ( a : & ~[ u8 ] , b : & ~[ u8 ] ) -> bool { memcmp ( a, b) > 0 }
2413-
24142372 /**
24152373 * Copies data from one vector to another.
24162374 *
@@ -2419,7 +2377,7 @@ pub mod bytes {
24192377 #[ inline]
24202378 pub fn copy_memory ( dst : & mut [ u8 ] , src : & [ u8 ] ) {
24212379 // Bound checks are done at vec::raw::copy_memory.
2422- unsafe { vec :: raw:: copy_memory ( dst, src) }
2380+ unsafe { raw:: copy_memory ( dst, src) }
24232381 }
24242382
24252383 /**
@@ -2435,7 +2393,7 @@ pub mod bytes {
24352393 ptr:: copy_memory ( p_dst. offset ( len_dst as int ) , p_src, len_src)
24362394 } )
24372395 } ) ;
2438- vec :: raw:: set_len ( dst, old_len + src. len ( ) ) ;
2396+ raw:: set_len ( dst, old_len + src. len ( ) ) ;
24392397 }
24402398 }
24412399}
0 commit comments