projects
/
libusual.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
57ab193
)
regex: simplify op_count_full error check
master
author
Marko Kreen
<
[email protected]
>
Tue, 30 Dec 2014 13:18:52 +0000
(15:18 +0200)
committer
Marko Kreen
<
[email protected]
>
Tue, 30 Dec 2014 13:18:52 +0000
(15:18 +0200)
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
usual/regex.c
patch
|
blob
|
blame
|
history
diff --git
a/usual/regex.c
b/usual/regex.c
index 28fbca7084c54f84be72e7068f91022846279853..a500fbb37f5df3df39cbbe0d0019e1bd436e442e 100644
(file)
--- 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;