@@ -310,7 +310,7 @@ impl<'a> ToCStr for &'a [u8] {
310310 let buf = malloc_raw ( self_len + 1 ) ;
311311
312312 ptr:: copy_memory ( buf, self . as_ptr ( ) , self_len) ;
313- * ptr :: mut_offset ( buf, self_len as int ) = 0 ;
313+ * buf. offset ( self_len as int ) = 0 ;
314314
315315 CString :: new ( buf as * libc:: c_char , true )
316316 }
@@ -368,7 +368,7 @@ impl<'a> Iterator<libc::c_char> for CChars<'a> {
368368 if ch == 0 {
369369 None
370370 } else {
371- self . ptr = unsafe { ptr :: offset ( self . ptr , 1 ) } ;
371+ self . ptr = unsafe { self . ptr . offset ( 1 ) } ;
372372 Some ( ch)
373373 }
374374 }
@@ -429,18 +429,18 @@ mod tests {
429429 fn test_str_to_c_str ( ) {
430430 "" . to_c_str ( ) . with_ref ( |buf| {
431431 unsafe {
432- assert_eq ! ( * ptr :: offset( buf , 0 ) , 0 ) ;
432+ assert_eq ! ( * buf . offset( 0 ) , 0 ) ;
433433 }
434434 } ) ;
435435
436436 "hello" . to_c_str ( ) . with_ref ( |buf| {
437437 unsafe {
438- assert_eq ! ( * ptr :: offset( buf , 0 ) , 'h' as libc:: c_char) ;
439- assert_eq ! ( * ptr :: offset( buf , 1 ) , 'e' as libc:: c_char) ;
440- assert_eq ! ( * ptr :: offset( buf , 2 ) , 'l' as libc:: c_char) ;
441- assert_eq ! ( * ptr :: offset( buf , 3 ) , 'l' as libc:: c_char) ;
442- assert_eq ! ( * ptr :: offset( buf , 4 ) , 'o' as libc:: c_char) ;
443- assert_eq ! ( * ptr :: offset( buf , 5 ) , 0 ) ;
438+ assert_eq ! ( * buf . offset( 0 ) , 'h' as libc:: c_char) ;
439+ assert_eq ! ( * buf . offset( 1 ) , 'e' as libc:: c_char) ;
440+ assert_eq ! ( * buf . offset( 2 ) , 'l' as libc:: c_char) ;
441+ assert_eq ! ( * buf . offset( 3 ) , 'l' as libc:: c_char) ;
442+ assert_eq ! ( * buf . offset( 4 ) , 'o' as libc:: c_char) ;
443+ assert_eq ! ( * buf . offset( 5 ) , 0 ) ;
444444 }
445445 } )
446446 }
@@ -450,28 +450,28 @@ mod tests {
450450 let b: & [ u8 ] = [ ] ;
451451 b. to_c_str ( ) . with_ref ( |buf| {
452452 unsafe {
453- assert_eq ! ( * ptr :: offset( buf , 0 ) , 0 ) ;
453+ assert_eq ! ( * buf . offset( 0 ) , 0 ) ;
454454 }
455455 } ) ;
456456
457457 let _ = bytes ! ( "hello" ) . to_c_str ( ) . with_ref ( |buf| {
458458 unsafe {
459- assert_eq ! ( * ptr :: offset( buf , 0 ) , 'h' as libc:: c_char) ;
460- assert_eq ! ( * ptr :: offset( buf , 1 ) , 'e' as libc:: c_char) ;
461- assert_eq ! ( * ptr :: offset( buf , 2 ) , 'l' as libc:: c_char) ;
462- assert_eq ! ( * ptr :: offset( buf , 3 ) , 'l' as libc:: c_char) ;
463- assert_eq ! ( * ptr :: offset( buf , 4 ) , 'o' as libc:: c_char) ;
464- assert_eq ! ( * ptr :: offset( buf , 5 ) , 0 ) ;
459+ assert_eq ! ( * buf . offset( 0 ) , 'h' as libc:: c_char) ;
460+ assert_eq ! ( * buf . offset( 1 ) , 'e' as libc:: c_char) ;
461+ assert_eq ! ( * buf . offset( 2 ) , 'l' as libc:: c_char) ;
462+ assert_eq ! ( * buf . offset( 3 ) , 'l' as libc:: c_char) ;
463+ assert_eq ! ( * buf . offset( 4 ) , 'o' as libc:: c_char) ;
464+ assert_eq ! ( * buf . offset( 5 ) , 0 ) ;
465465 }
466466 } ) ;
467467
468468 let _ = bytes ! ( "foo" , 0xff ) . to_c_str ( ) . with_ref ( |buf| {
469469 unsafe {
470- assert_eq ! ( * ptr :: offset( buf , 0 ) , 'f' as libc:: c_char) ;
471- assert_eq ! ( * ptr :: offset( buf , 1 ) , 'o' as libc:: c_char) ;
472- assert_eq ! ( * ptr :: offset( buf , 2 ) , 'o' as libc:: c_char) ;
473- assert_eq ! ( * ptr :: offset( buf , 3 ) , 0xff as i8 ) ;
474- assert_eq ! ( * ptr :: offset( buf , 4 ) , 0 ) ;
470+ assert_eq ! ( * buf . offset( 0 ) , 'f' as libc:: c_char) ;
471+ assert_eq ! ( * buf . offset( 1 ) , 'o' as libc:: c_char) ;
472+ assert_eq ! ( * buf . offset( 2 ) , 'o' as libc:: c_char) ;
473+ assert_eq ! ( * buf . offset( 3 ) , 0xff as i8 ) ;
474+ assert_eq ! ( * buf . offset( 4 ) , 0 ) ;
475475 }
476476 } ) ;
477477 }
@@ -634,16 +634,15 @@ mod bench {
634634 use extra:: test:: BenchHarness ;
635635 use libc;
636636 use prelude:: * ;
637- use ptr;
638637
639638 #[ inline]
640639 fn check ( s : & str , c_str : * libc:: c_char ) {
641640 let s_buf = s. as_ptr ( ) ;
642641 for i in range ( 0 , s. len ( ) ) {
643642 unsafe {
644643 assert_eq ! (
645- * ptr :: offset( s_buf , i as int) as libc:: c_char,
646- * ptr :: offset( c_str , i as int) ) ;
644+ * s_buf . offset( i as int) as libc:: c_char,
645+ * c_str . offset( i as int) ) ;
647646 }
648647 }
649648 }
0 commit comments