From 507a58460e9c33361baf3f1cbf2b95c9cb0dd5ae Mon Sep 17 00:00:00 2001 From: David Steele Date: Sat, 29 Feb 2020 07:52:54 -0500 Subject: [PATCH] Minor adjustments to common prefix code updated in 8ec41efb. --- src/common/regExp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/regExp.c b/src/common/regExp.c index 1fe93e66f..4d91b9935 100644 --- a/src/common/regExp.c +++ b/src/common/regExp.c @@ -233,17 +233,17 @@ regExpPrefix(const String *expression) // Will there be any characters in the prefix? if (expressionIdx > 1) { - // Search again and make sure there is not another begin anchor. If so we won't be able to use the prefix + // Search the rest of the string for another begin anchor unsigned int anchorIdx = expressionIdx; - for (anchorIdx = 1; anchorIdx < expressionSize; anchorIdx++) + for (; anchorIdx < expressionSize; anchorIdx++) { // [^ and \^ are not begin anchors if (expressionZ[anchorIdx] == '^' && expressionZ[anchorIdx - 1] != '[' && expressionZ[anchorIdx - 1] != '\\') break; } - // If another begin anchor was not found then return the prefix + // If no other begin anchor was found then the prefix is usable if (anchorIdx == expressionSize) result = strSubN(expression, 1, expressionIdx - 1); }