Skip to content

Commit 77561f5

Browse files
committed
csgrep: invert the condition in chainFilters()
... so that a failure is handled in the `if` block. No changes in behavior intended with this commit.
1 parent 4123efe commit 77561f5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/csgrep.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,14 @@ bool chainFilters(
519519
if (vm.count("invert-regex"))
520520
pf->setInvertEachMatch();
521521

522-
if (chainFiltersCore(pf, vm, flags))
523-
return true;
522+
if (!chainFiltersCore(pf, vm, flags)) {
523+
// failed to create the chain of filters
524+
delete pf;
525+
*pEng = 0;
526+
return false;
527+
}
524528

525-
// failed to create the chain of filters
526-
delete pf;
527-
*pEng = 0;
528-
return false;
529+
return true;
529530
}
530531

531532
int main(int argc, char *argv[])

0 commit comments

Comments
 (0)