1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

device_mapper: slight improvement of tok_match

Reduce amount of unnecessary instructions for some code paths.
This commit is contained in:
Zdenek Kabelac 2024-10-09 17:16:44 +02:00 committed by David Teigland
parent 00a8946e46
commit eea78613ef

View File

@ -85,14 +85,19 @@ static char *_dup_token(struct dm_pool *mem, const char *b, const char *e);
} \ } \
} while(0) } while(0)
/* match token */
static int _tok_match(const char *str, const char *b, const char *e) static int _tok_match(const char *str, const char *b, const char *e)
{ {
while (*str && (b != e)) { while (b < e) {
if (*str++ != *b++) if (*str != *b)
return 0; return 0;
if (!*str)
return 0;
++str;
++b;
} }
return !(*str || (b != e)); return !*str; /* token is matching for \0 end */
} }
struct dm_config_tree *dm_config_create(void) struct dm_config_tree *dm_config_create(void)