From 536eee6d0bf8eb99b6566f7f4fd646b3cd76f532 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Thu, 21 Aug 2014 01:45:52 +0300 Subject: [PATCH] Skip leading whitespace. --- lib/filter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/filter.c b/lib/filter.c index ad1b937..04733c5 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -54,9 +54,12 @@ static char* _bmFilterTokenize(bmMenu *menu, char ***outTokv, unsigned int *outT if (!(buffer = _bmStrdup(menu->filter))) goto fail; + char *s; + for (s = buffer; *s && *s == ' '; ++s); + + char **tmp = NULL; size_t pos = 0, next; unsigned int tokc = 0, tokn = 0; - char *s = buffer, **tmp = NULL; for (; (pos = _bmStripToken(s, " ", &next)) > 0; tokv = tmp) { if (++tokc > tokn && !(tmp = realloc(tokv, ++tokn * sizeof(char*)))) goto fail;