@@ -84,32 +84,31 @@ fprintf(stream, "%s%s%s%s%s%s%s%s%s\n",
8484 ((match_options & PCRE2_PARTIAL_SOFT ) != 0 )? ",partial_soft" : "" );
8585}
8686
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 )
8888{
8989PCRE2_UCHAR error_buf [256 ];
9090int errorcode ;
91- uint32_t ovector_count = pcre2_get_ovector_count (match_data );
9291
93- for (uint32_t ovector = ovector_count ; ovector < ovector_count ; ovector ++ )
92+ for (uint32_t index = 0 ; index < count ; index ++ )
9493 {
9594 PCRE2_UCHAR * bufferptr = NULL ;
9695 PCRE2_SIZE bufflen = 0 ;
9796
98- errorcode = pcre2_substring_get_bynumber (match_data , ovector , & bufferptr , & bufflen );
97+ errorcode = pcre2_substring_get_bynumber (match_data , index , & bufferptr , & bufflen );
9998
10099 if (errorcode >= 0 )
101100 {
102- fprintf (stream , "Match %d (hex encoded): " , ovector );
101+ fprintf (stream , "Match %d (hex encoded): " , index );
103102 for (PCRE2_SIZE i = 0 ; i < bufflen ; i ++ )
104103 {
105- fprintf (stderr , "%02x" , bufferptr [i ]);
104+ fprintf (stream , "%02x" , bufferptr [i ]);
106105 }
107- fprintf (stderr , "\n" );
106+ fprintf (stream , "\n" );
108107 }
109108 else
110109 {
111110 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 );
113112 }
114113 }
115114}
153152 fprintf (stderr , "Non-JIT'd operation did not emit an error.\n" );
154153 if (match_data != NULL )
155154 {
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 );
158157 fprintf (stderr , "\n" );
159158 }
160159 }
169168 fprintf (stderr , "JIT'd operation did not emit an error.\n" );
170169 if (match_data_jit != NULL )
171170 {
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 );
174173 fprintf (stderr , "\n" );
175174 }
176175 }
@@ -247,7 +246,6 @@ for (i = 0; i < 2; i++)
247246 int errorcode ;
248247#ifdef SUPPORT_JIT
249248 int errorcode_jit ;
250- uint32_t ovector_count ;
251249#endif
252250 PCRE2_SIZE erroroffset ;
253251 pcre2_code * code ;
@@ -339,23 +337,16 @@ for (i = 0; i < 2; i++)
339337 describe_failure ("match errorcode comparison" , data , size , compile_options , match_options , errorcode , match_data , errorcode_jit , match_data_jit , match_context );
340338 }
341339
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 ++ )
350341 {
351342 PCRE2_UCHAR * bufferptr , * bufferptr_jit ;
352343 PCRE2_SIZE bufflen , bufflen_jit ;
353344
354345 bufferptr = bufferptr_jit = NULL ;
355346 bufflen = bufflen_jit = 0 ;
356347
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 );
359350
360351 if (errorcode != errorcode_jit )
361352 {
0 commit comments