From ad73e517a45ccc3257576eab90dab18e9c6a28f3 Mon Sep 17 00:00:00 2001 From: Nicolas Le Cam Date: Mon, 22 Dec 2008 08:20:25 +0000 Subject: [PATCH] Fix simpleMatch when pattern only contain one word --- token.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/token.cpp b/token.cpp index bf45d3d9b..ebe3fde13 100644 --- a/token.cpp +++ b/token.cpp @@ -137,7 +137,8 @@ int TOKEN::multiCompare( const char *needle, const char *haystack ) bool TOKEN::simpleMatch(const TOKEN *tok, const char pattern[]) { - for ( const char *current = pattern, *next = strchr(pattern, ' '), *tmp; *current; current = next, + for ( const char *current = pattern, *tmp = strchr(pattern, ' '), *next = tmp ? tmp : (pattern + strlen(pattern)); + *current; current = next, next = *next ? ((tmp = strchr(++current, ' ')) ? tmp : (current + strlen(current))) : next, tok = tok->next() ) { if ( !tok || (next-current) != tok->_str.length() || strncmp( current, tok->_cstr, next-current) )