@@ -2351,10 +2351,7 @@ pub mod raw {
2351
2351
2352
2352
/// Operations on `[u8]`
2353
2353
pub mod bytes {
2354
- use libc;
2355
- use num;
2356
2354
use vec:: raw;
2357
- use vec;
2358
2355
use ptr;
2359
2356
2360
2357
/// A trait for operations on mutable operations on `[u8]`
@@ -2372,45 +2369,6 @@ pub mod bytes {
2372
2369
}
2373
2370
}
2374
2371
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
-
2414
2372
/**
2415
2373
* Copies data from one vector to another.
2416
2374
*
@@ -2419,7 +2377,7 @@ pub mod bytes {
2419
2377
#[ inline]
2420
2378
pub fn copy_memory ( dst : & mut [ u8 ] , src : & [ u8 ] ) {
2421
2379
// Bound checks are done at vec::raw::copy_memory.
2422
- unsafe { vec :: raw:: copy_memory ( dst, src) }
2380
+ unsafe { raw:: copy_memory ( dst, src) }
2423
2381
}
2424
2382
2425
2383
/**
@@ -2435,7 +2393,7 @@ pub mod bytes {
2435
2393
ptr:: copy_memory ( p_dst. offset ( len_dst as int ) , p_src, len_src)
2436
2394
} )
2437
2395
} ) ;
2438
- vec :: raw:: set_len ( dst, old_len + src. len ( ) ) ;
2396
+ raw:: set_len ( dst, old_len + src. len ( ) ) ;
2439
2397
}
2440
2398
}
2441
2399
}
0 commit comments