From 5e526f44cd5f9786208dc4ece9fa056567fbc995 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Sat, 15 Aug 2009 18:18:27 +0000 Subject: [PATCH] 'everything' module: fuzzy_match: remove white spaces at the beginning SVN revision: 41791 --- src/modules/everything/evry.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index d0b72d576..ffa1908bb 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -473,11 +473,12 @@ evry_fuzzy_match(const char *str, const char *match) if (!match || !str) return 0; - if ((match[0] == 0) || - (match[1] == 0)) return 0; - word_min[0] = MAX_FUZZ; + /* remove white spaces at the beginning */ + for (; (*match != 0) && isspace(*match); match++); + for (; (*str != 0) && isspace(*str); str++); + for (m = match; *m != 0 && *(m+1) != 0; m++) { if (isspace(*m) && !isspace(*(m+1))) @@ -490,7 +491,7 @@ evry_fuzzy_match(const char *str, const char *match) p = next = str; m = match; - for (word = 0; word < words && p && *p != 0;) + for (word = 0; word < words && *p != 0;) { /* reset match */ if (word == 0) m = match; @@ -555,7 +556,7 @@ evry_fuzzy_match(const char *str, const char *match) continue; } - /* end of match store min weight of match */ + /* end of match: store min weight of match */ if (min < word_min[word]) word_min[word] = min;