From: Daniel Carl Date: Fri, 5 Sep 2014 21:09:28 +0000 (+0200) Subject: Faster return for wildmatch with trailing '*'. X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=7ac4c9a21ba4032e2c9ac91b7ede43c6d44e3ba0;p=vimb.git Faster return for wildmatch with trailing '*'. If the pattern ends in '*' it's not necessary to call the wildmatch, because this will match everything. --- diff --git a/src/util.c b/src/util.c index 5c4a2ee..1084482 100644 --- a/src/util.c +++ b/src/util.c @@ -542,8 +542,13 @@ gboolean util_wildmatch(const char *pattern, const char *string) break; case '*': + /* easiest case - the '*' ist the last char in pattern - this + * will always match */ + if (*(p + 1) == '\0') { + return true; + } /* Try to match as much as possible. Try to match the complete - * uri, if that fails move forward in uri and chack for a + * uri, if that fails move forward in uri and check for a * match. */ i = strlen(s); while (i >= 0 && !util_wildmatch(p + 1, s + i)) {