@@ -84,32 +84,31 @@ fprintf(stream, "%s%s%s%s%s%s%s%s%s\n",
84
84
((match_options & PCRE2_PARTIAL_SOFT ) != 0 )? ",partial_soft" : "" );
85
85
}
86
86
87
- static void dump_matches (FILE * stream , pcre2_match_data * match_data , pcre2_match_context * match_context )
87
+ static void dump_matches (FILE * stream , int count , pcre2_match_data * match_data , pcre2_match_context * match_context )
88
88
{
89
89
PCRE2_UCHAR error_buf [256 ];
90
90
int errorcode ;
91
- uint32_t ovector_count = pcre2_get_ovector_count (match_data );
92
91
93
- for (uint32_t ovector = ovector_count ; ovector < ovector_count ; ovector ++ )
92
+ for (uint32_t index = 0 ; index < count ; index ++ )
94
93
{
95
94
PCRE2_UCHAR * bufferptr = NULL ;
96
95
PCRE2_SIZE bufflen = 0 ;
97
96
98
- errorcode = pcre2_substring_get_bynumber (match_data , ovector , & bufferptr , & bufflen );
97
+ errorcode = pcre2_substring_get_bynumber (match_data , index , & bufferptr , & bufflen );
99
98
100
99
if (errorcode >= 0 )
101
100
{
102
- fprintf (stream , "Match %d (hex encoded): " , ovector );
101
+ fprintf (stream , "Match %d (hex encoded): " , index );
103
102
for (PCRE2_SIZE i = 0 ; i < bufflen ; i ++ )
104
103
{
105
- fprintf (stderr , "%02x" , bufferptr [i ]);
104
+ fprintf (stream , "%02x" , bufferptr [i ]);
106
105
}
107
- fprintf (stderr , "\n" );
106
+ fprintf (stream , "\n" );
108
107
}
109
108
else
110
109
{
111
110
pcre2_get_error_message (errorcode , error_buf , 256 );
112
- fprintf (stream , "Match %d failed: %s\n" , ovector , error_buf );
111
+ fprintf (stream , "Match %d failed: %s\n" , index , error_buf );
113
112
}
114
113
}
115
114
}
153
152
fprintf (stderr , "Non-JIT'd operation did not emit an error.\n" );
154
153
if (match_data != NULL )
155
154
{
156
- fprintf (stderr , "%d matches discovered by non-JIT'd regex:\n" , pcre2_get_ovector_count ( match_data ) );
157
- dump_matches (stderr , match_data , match_context );
155
+ fprintf (stderr , "%d matches discovered by non-JIT'd regex:\n" , errorcode );
156
+ dump_matches (stderr , errorcode , match_data , match_context );
158
157
fprintf (stderr , "\n" );
159
158
}
160
159
}
169
168
fprintf (stderr , "JIT'd operation did not emit an error.\n" );
170
169
if (match_data_jit != NULL )
171
170
{
172
- fprintf (stderr , "%d matches discovered by JIT'd regex:\n" , pcre2_get_ovector_count ( match_data_jit ) );
173
- dump_matches (stderr , match_data_jit , match_context );
171
+ fprintf (stderr , "%d matches discovered by JIT'd regex:\n" , errorcode_jit );
172
+ dump_matches (stderr , errorcode_jit , match_data_jit , match_context );
174
173
fprintf (stderr , "\n" );
175
174
}
176
175
}
@@ -247,7 +246,6 @@ for (i = 0; i < 2; i++)
247
246
int errorcode ;
248
247
#ifdef SUPPORT_JIT
249
248
int errorcode_jit ;
250
- uint32_t ovector_count ;
251
249
#endif
252
250
PCRE2_SIZE erroroffset ;
253
251
pcre2_code * code ;
@@ -339,23 +337,16 @@ for (i = 0; i < 2; i++)
339
337
describe_failure ("match errorcode comparison" , data , size , compile_options , match_options , errorcode , match_data , errorcode_jit , match_data_jit , match_context );
340
338
}
341
339
342
- ovector_count = pcre2_get_ovector_count (match_data );
343
-
344
- if (ovector_count != pcre2_get_ovector_count (match_data_jit ))
345
- {
346
- describe_failure ("ovector count comparison" , data , size , compile_options , match_options , errorcode , match_data , errorcode_jit , match_data_jit , match_context );
347
- }
348
-
349
- for (uint32_t ovector = 0 ; ovector < ovector_count ; ovector ++ )
340
+ for (int index = 0 ; index < errorcode ; index ++ )
350
341
{
351
342
PCRE2_UCHAR * bufferptr , * bufferptr_jit ;
352
343
PCRE2_SIZE bufflen , bufflen_jit ;
353
344
354
345
bufferptr = bufferptr_jit = NULL ;
355
346
bufflen = bufflen_jit = 0 ;
356
347
357
- errorcode = pcre2_substring_get_bynumber (match_data , ovector , & bufferptr , & bufflen );
358
- errorcode_jit = pcre2_substring_get_bynumber (match_data_jit , ovector , & bufferptr_jit , & bufflen_jit );
348
+ errorcode = pcre2_substring_get_bynumber (match_data , ( uint32_t ) index , & bufferptr , & bufflen );
349
+ errorcode_jit = pcre2_substring_get_bynumber (match_data_jit , ( uint32_t ) index , & bufferptr_jit , & bufflen_jit );
359
350
360
351
if (errorcode != errorcode_jit )
361
352
{
0 commit comments