From 7ac4c9a21ba4032e2c9ac91b7ede43c6d44e3ba0 Mon Sep 17 00:00:00 2001
From: Daniel Carl <danielcarl@gmx.de>
Date: Fri, 5 Sep 2014 23:09:28 +0200
Subject: [PATCH] Faster return for wildmatch with trailing '*'.

If the pattern ends in '*' it's not necessary to call the wildmatch, because
this will match everything.
---
 src/util.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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)) {
-- 
2.20.1