mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-19 19:25:41 +02:00
particle/map: code style
This commit is contained in:
parent
37ecc251a4
commit
20d48a753b
1 changed files with 12 additions and 10 deletions
|
@ -21,10 +21,9 @@ string_like(const char* name, const char* pattern)
|
||||||
LOG_DBG("pattern:%s name:%s", pattern, name);
|
LOG_DBG("pattern:%s name:%s", pattern, name);
|
||||||
int px = 0, nx = 0;
|
int px = 0, nx = 0;
|
||||||
int nextpx = 0, nextnx = 0;
|
int nextpx = 0, nextnx = 0;
|
||||||
while(px < strlen(pattern) || nx < strlen(name))
|
|
||||||
{
|
while (px < strlen(pattern) || nx < strlen(name)) {
|
||||||
if(px < strlen(pattern))
|
if (px < strlen(pattern)) {
|
||||||
{
|
|
||||||
char c = pattern[px];
|
char c = pattern[px];
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '?': {
|
case '?': {
|
||||||
|
@ -52,15 +51,18 @@ string_like(const char* name, const char* pattern)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// mismatch
|
// mismatch
|
||||||
if (0 < nextnx && nextnx <= strlen(name)) {
|
if (0 < nextnx && nextnx <= strlen(name)) {
|
||||||
px = nextpx;
|
px = nextpx;
|
||||||
nx = nextnx;
|
nx = nextnx;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DBG("map: name %s matched all the pattern %s", name, pattern);
|
LOG_DBG("map: name %s matched all the pattern %s", name, pattern);
|
||||||
// Matched all of pattern to all of name. Success.
|
// Matched all of pattern to all of name. Success.
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue