1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Minor adjustments to common prefix code updated in 8ec41efb.

This commit is contained in:
David Steele 2020-02-29 07:52:54 -05:00
parent 8ec41efb04
commit 507a58460e

View File

@ -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);
}