mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
slre: refactor is_any_but()
As preparation for fixing the handling of backslash-escapes used inside a character class, refactor is_any_but() to be defined in terms of is_any_of() so we don't have to repeat the same logic in two places. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
This commit is contained in:
committed by
Tom Rini
parent
ebdd78c487
commit
457f19815c
15
lib/slre.c
15
lib/slre.c
@@ -484,17 +484,14 @@ is_any_of(const unsigned char *p, int len, const char *s, int *ofs)
|
||||
static int
|
||||
is_any_but(const unsigned char *p, int len, const char *s, int *ofs)
|
||||
{
|
||||
int i, ch;
|
||||
int dummy = *ofs;
|
||||
|
||||
ch = s[*ofs];
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (p[i] == ch)
|
||||
return 0;
|
||||
if (is_any_of(p, len, s, &dummy)) {
|
||||
return 0;
|
||||
} else {
|
||||
(*ofs)++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
(*ofs)++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
Reference in New Issue
Block a user