Mercurial > hg > MonetDB-extend
comparison regexp/regexp.c @ 55:68263b10998e
Updated: added bat_iterator_end.
author | Sjoerd Mullender <sjoerd@acm.org> |
---|---|
date | Wed, 26 Jan 2022 14:59:05 +0100 (2022-01-26) |
parents | da896864dbbd |
children | 8122094c79b1 |
comparison
equal
deleted
inserted
replaced
54:9ff721585946 | 55:68263b10998e |
---|---|
195 bn->tnonil = false; | 195 bn->tnonil = false; |
196 } else { | 196 } else { |
197 pos = pcre_exec(re, sd, val, (int) strlen(val), 0, 0, NULL, 0); | 197 pos = pcre_exec(re, sd, val, (int) strlen(val), 0, 0, NULL, 0); |
198 if (pos < 0 && pos != PCRE_ERROR_NOMATCH && pos != PCRE_ERROR_BADUTF8) { | 198 if (pos < 0 && pos != PCRE_ERROR_NOMATCH && pos != PCRE_ERROR_BADUTF8) { |
199 /* error during processing */ | 199 /* error during processing */ |
200 bat_iterator_end(&bi); | |
200 BBPunfix(b->batCacheid); | 201 BBPunfix(b->batCacheid); |
201 BBPreclaim(bn); | 202 BBPreclaim(bn); |
202 pcre_free_study(sd); | 203 pcre_free_study(sd); |
203 pcre_free(re); | 204 pcre_free(re); |
204 throw(MAL, "batregexp.rematch", | 205 throw(MAL, "batregexp.rematch", |
206 pat, pos); | 207 pat, pos); |
207 } | 208 } |
208 *outp++ = pos >= 0; /* TRUE if match, FALSE if not */ | 209 *outp++ = pos >= 0; /* TRUE if match, FALSE if not */ |
209 } | 210 } |
210 } | 211 } |
212 bat_iterator_end(&bi); | |
211 | 213 |
212 /* set properties and size of result BAT */ | 214 /* set properties and size of result BAT */ |
213 BATsetcount(bn, BATcount(b)); | 215 BATsetcount(bn, BATcount(b)); |
214 | 216 |
215 if (BATcount(bn) > 1) { | 217 if (BATcount(bn) > 1) { |
379 /* regular expression didn't match */ | 381 /* regular expression didn't match */ |
380 if (anti) | 382 if (anti) |
381 *outp++ = o; | 383 *outp++ = o; |
382 } else { | 384 } else { |
383 /* error during processing */ | 385 /* error during processing */ |
386 bat_iterator_end(&bi); | |
384 BBPunfix(b->batCacheid); | 387 BBPunfix(b->batCacheid); |
385 BBPunfix(s->batCacheid); | 388 BBPunfix(s->batCacheid); |
386 BBPreclaim(bn); | 389 BBPreclaim(bn); |
387 pcre_free_study(sd); | 390 pcre_free_study(sd); |
388 pcre_free(re); | 391 pcre_free(re); |
390 "matching of regular expression (%s) failed with %d", | 393 "matching of regular expression (%s) failed with %d", |
391 pat, pos); | 394 pat, pos); |
392 } | 395 } |
393 } | 396 } |
394 } | 397 } |
398 /* we're done with the BAT iterator */ | |
399 bat_iterator_end(&bi); | |
395 /* we're done with b, s, and re */ | 400 /* we're done with b, s, and re */ |
396 BBPunfix(b->batCacheid); | 401 BBPunfix(b->batCacheid); |
397 if (s) | 402 if (s) |
398 BBPunfix(s->batCacheid); | 403 BBPunfix(s->batCacheid); |
399 pcre_free_study(sd); | 404 pcre_free_study(sd); |
608 } | 613 } |
609 } | 614 } |
610 pcre_free_study(sd); | 615 pcre_free_study(sd); |
611 pcre_free(re); | 616 pcre_free(re); |
612 } | 617 } |
618 bat_iterator_end(&li); | |
619 bat_iterator_end(&ri); | |
613 | 620 |
614 BBPunfix(l->batCacheid); | 621 BBPunfix(l->batCacheid); |
615 BBPunfix(r->batCacheid); | 622 BBPunfix(r->batCacheid); |
616 if (sl) | 623 if (sl) |
617 BBPunfix(sl->batCacheid); | 624 BBPunfix(sl->batCacheid); |
622 BBPkeepref(*lres); | 629 BBPkeepref(*lres); |
623 BBPkeepref(*rres); | 630 BBPkeepref(*rres); |
624 return MAL_SUCCEED; | 631 return MAL_SUCCEED; |
625 | 632 |
626 bailout: | 633 bailout: |
634 bat_iterator_end(&li); | |
635 bat_iterator_end(&ri); | |
627 BBPreclaim(bn1); | 636 BBPreclaim(bn1); |
628 BBPreclaim(bn2); | 637 BBPreclaim(bn2); |
629 BBPunfix(l->batCacheid); | 638 BBPunfix(l->batCacheid); |
630 BBPunfix(r->batCacheid); | 639 BBPunfix(r->batCacheid); |
631 if (sl) | 640 if (sl) |