summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Kreen2014-12-30 13:18:52 +0000
committerMarko Kreen2014-12-30 13:18:52 +0000
commitfe4dd0255ea796e64599c0fc28e6900fbc07e6aa (patch)
tree27dd4bdc30bf84dc355ee771144a65dbc3735300
parent57ab19322d1165ab342113b1e545b8256ee49b77 (diff)
regex: simplify op_count_full error checkHEADmaster
There was dummy loop with size limit for "performace" reasons, but it triggered automatic checkers. Remove complexity by using strchr() there. Reported-By: David Binderman
-rw-r--r--usual/regex.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/usual/regex.c b/usual/regex.c
index 28fbca7..a500fbb 100644
--- a/usual/regex.c
+++ b/usual/regex.c
@@ -315,11 +315,7 @@ static int op_count_full(struct ParseCtx *ctx, const char **re)
}
/* bad fmt, decide between error codes */
- for (a = 0; end[a] && a < 5; a++) {
- if (end[a] == '}')
- return REG_BADBR;
- }
- return REG_EBRACE;
+ return strchr(end, '}') ? REG_BADBR : REG_EBRACE;
done:
ctx->last_elem->mincnt = a;