380b37f4a7
- add an rc script - fix incompatibility with pcre 8.3+, patch from Debian - distfiles are now on sourceforge - drop maintainer; no response to emails ok abieber@
45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
$OpenBSD: patch-src_RegExp_cpp,v 1.1 2013/01/18 15:04:09 sthen Exp $
|
|
|
|
pcre 8.30 fix, from Debian
|
|
|
|
--- src/RegExp.cpp.orig Wed Jan 16 21:13:58 2013
|
|
+++ src/RegExp.cpp Wed Jan 16 21:15:43 2013
|
|
@@ -146,14 +146,17 @@ bool RegExp::match(const char *text)
|
|
offsets.clear();
|
|
lengths.clear();
|
|
imatched = false;
|
|
- regmatch_t *pmatch = new regmatch_t[reg.re_nsub + 1]; // to hold result
|
|
+ int num_sub_expressions = MAX_SUB_EXPRESSIONS;
|
|
+ if(reg.re_nsub < num_sub_expressions)
|
|
+ num_sub_expressions = reg.re_nsub;
|
|
+ regmatch_t *pmatch = new regmatch_t[num_sub_expressions + 1]; // to hold result
|
|
if (!pmatch) { // if it failed
|
|
delete[]pmatch;
|
|
imatched = false;
|
|
return false;
|
|
// exception?
|
|
}
|
|
- if (regexec(®, pos, reg.re_nsub + 1, pmatch, 0)) { // run regex
|
|
+ if (regexec(®, pos, num_sub_expressions + 1, pmatch, 0)) { // run regex
|
|
delete[]pmatch;
|
|
imatched = false;
|
|
// #ifdef DGDEBUG
|
|
@@ -167,7 +170,7 @@ bool RegExp::match(const char *text)
|
|
int error = 0;
|
|
while (error == 0) {
|
|
largestoffset = 0;
|
|
- for (i = 0; i <= (signed) reg.re_nsub; i++) {
|
|
+ for (i = 0; i <= (signed) num_sub_expressions; i++) {
|
|
if (pmatch[i].rm_so != -1) {
|
|
matchlen = pmatch[i].rm_eo - pmatch[i].rm_so;
|
|
submatch = new char[matchlen + 1];
|
|
@@ -184,7 +187,7 @@ bool RegExp::match(const char *text)
|
|
}
|
|
if (largestoffset > 0) {
|
|
pos += largestoffset;
|
|
- error = regexec(®, pos, reg.re_nsub + 1, pmatch, REG_NOTBOL);
|
|
+ error = regexec(®, pos, num_sub_expressions + 1, pmatch, REG_NOTBOL);
|
|
} else {
|
|
error = -1;
|
|
}
|