@@ -110,7 +110,7 @@ pub struct CompilationError {
110
110
#[ deriving( Show ) ]
111
111
pub struct Pcre {
112
112
113
- code : * detail:: pcre ,
113
+ code : * const detail:: pcre ,
114
114
115
115
extra : * mut PcreExtra ,
116
116
@@ -127,7 +127,7 @@ pub struct PcreExtra {
127
127
study_data : * mut c_void ,
128
128
match_limit_ : c_ulong ,
129
129
callout_data : * mut c_void ,
130
- tables : * c_uchar ,
130
+ tables : * const c_uchar ,
131
131
match_limit_recursion_ : c_ulong ,
132
132
mark : * mut * mut c_uchar ,
133
133
executable_jit : * mut c_void
@@ -148,9 +148,9 @@ pub struct Match<'a> {
148
148
/// Iterator type for iterating matches within a subject string.
149
149
pub struct MatchIterator < ' a > {
150
150
151
- code : * detail:: pcre ,
151
+ code : * const detail:: pcre ,
152
152
153
- extra : * PcreExtra ,
153
+ extra : * const PcreExtra ,
154
154
155
155
capture_count : c_int ,
156
156
@@ -353,22 +353,22 @@ impl Pcre {
353
353
pattern. with_c_str ( |pattern_c_str| {
354
354
unsafe {
355
355
// Use the default character tables.
356
- let tableptr: * c_uchar = ptr:: null ( ) ;
356
+ let tableptr: * const c_uchar = ptr:: null ( ) ;
357
357
match detail:: pcre_compile ( pattern_c_str, options, tableptr) {
358
358
Err ( ( opt_err, erroffset) ) => Err ( CompilationError {
359
359
opt_err : opt_err,
360
360
erroffset : erroffset
361
361
} ) ,
362
362
Ok ( mut_code) => {
363
- let code = mut_code as * detail:: pcre ;
363
+ let code = mut_code as * const detail:: pcre ;
364
364
assert ! ( code. is_not_null( ) ) ;
365
365
// Take a reference.
366
366
detail:: pcre_refcount ( code as * mut detail:: pcre , 1 ) ;
367
367
368
368
let extra: * mut PcreExtra = ptr:: mut_null ( ) ;
369
369
370
370
let mut capture_count: c_int = 0 ;
371
- detail:: pcre_fullinfo ( code, extra as * PcreExtra , detail:: PCRE_INFO_CAPTURECOUNT ,
371
+ detail:: pcre_fullinfo ( code, extra as * const PcreExtra , detail:: PCRE_INFO_CAPTURECOUNT ,
372
372
& mut capture_count as * mut c_int as * mut c_void ) ;
373
373
374
374
Ok ( Pcre {
@@ -492,7 +492,7 @@ impl Pcre {
492
492
493
493
unsafe {
494
494
subject. with_c_str_unchecked ( |subject_c_str| -> Option < Match < ' a > > {
495
- let rc = detail:: pcre_exec ( self . code , self . extra as * PcreExtra , subject_c_str, subject. len ( ) as c_int , startoffset as c_int , options, ovector. as_mut_ptr ( ) , ovecsize as c_int ) ;
495
+ let rc = detail:: pcre_exec ( self . code , self . extra as * const PcreExtra , subject_c_str, subject. len ( ) as c_int , startoffset as c_int , options, ovector. as_mut_ptr ( ) , ovecsize as c_int ) ;
496
496
if rc >= 0 {
497
497
Some ( Match {
498
498
subject : subject,
@@ -519,8 +519,8 @@ impl Pcre {
519
519
None
520
520
} else {
521
521
let slice: Slice < c_uchar > = Slice {
522
- data : self . mark_ as * c_uchar ,
523
- len : libc:: strlen ( self . mark_ as * c_char ) as uint
522
+ data : self . mark_ as * const c_uchar ,
523
+ len : libc:: strlen ( self . mark_ as * const c_char ) as uint
524
524
} ;
525
525
Some ( mem:: transmute ( slice) )
526
526
}
@@ -551,7 +551,7 @@ impl Pcre {
551
551
let ovecsize = ( self . capture_count_ + 1 ) * 3 ;
552
552
MatchIterator {
553
553
code : { detail:: pcre_refcount ( self . code as * mut detail:: pcre , 1 ) ; self . code } ,
554
- extra : self . extra as * PcreExtra ,
554
+ extra : self . extra as * const PcreExtra ,
555
555
capture_count : self . capture_count_ ,
556
556
subject : subject,
557
557
subject_cstring : subject. to_c_str_unchecked ( ) , // the subject string can contain NUL bytes
@@ -566,7 +566,7 @@ impl Pcre {
566
566
pub fn name_count ( & self ) -> uint {
567
567
unsafe {
568
568
let mut name_count: c_int = 0 ;
569
- detail:: pcre_fullinfo ( self . code , self . extra as * PcreExtra , detail:: PCRE_INFO_NAMECOUNT , & mut name_count as * mut c_int as * mut c_void ) ;
569
+ detail:: pcre_fullinfo ( self . code , self . extra as * const PcreExtra , detail:: PCRE_INFO_NAMECOUNT , & mut name_count as * mut c_int as * mut c_void ) ;
570
570
name_count as uint
571
571
}
572
572
}
@@ -580,17 +580,17 @@ impl Pcre {
580
580
pub fn name_table ( & self ) -> TreeMap < String , Vec < uint > > {
581
581
unsafe {
582
582
let name_count = self . name_count ( ) ;
583
- let mut tabptr: * c_uchar = ptr:: null ( ) ;
584
- detail:: pcre_fullinfo ( self . code , self . extra as * PcreExtra , detail:: PCRE_INFO_NAMETABLE , & mut tabptr as * mut * c_uchar as * mut c_void ) ;
583
+ let mut tabptr: * const c_uchar = ptr:: null ( ) ;
584
+ detail:: pcre_fullinfo ( self . code , self . extra as * const PcreExtra , detail:: PCRE_INFO_NAMETABLE , & mut tabptr as * mut * const c_uchar as * mut c_void ) ;
585
585
let mut name_entry_size: c_int = 0 ;
586
- detail:: pcre_fullinfo ( self . code , self . extra as * PcreExtra , detail:: PCRE_INFO_NAMEENTRYSIZE , & mut name_entry_size as * mut c_int as * mut c_void ) ;
586
+ detail:: pcre_fullinfo ( self . code , self . extra as * const PcreExtra , detail:: PCRE_INFO_NAMEENTRYSIZE , & mut name_entry_size as * mut c_int as * mut c_void ) ;
587
587
588
588
let mut name_table: TreeMap < String , Vec < uint > > = TreeMap :: new ( ) ;
589
589
590
590
let mut i = 0 u;
591
591
while i < name_count {
592
592
let n: uint = ( ptr:: read ( tabptr) as uint << 8 ) | ( ptr:: read ( tabptr. offset ( 1 ) ) as uint ) ;
593
- let name_cstring = c_str:: CString :: new ( tabptr. offset ( 2 ) as * c_char , false ) ;
593
+ let name_cstring = c_str:: CString :: new ( tabptr. offset ( 2 ) as * const c_char , false ) ;
594
594
let name: String = name_cstring. as_str ( ) . unwrap ( ) . to_owned ( ) ;
595
595
// TODO Avoid the double lookup.
596
596
// https://github.com/mozilla/rust/issues/9068
0 commit comments