From: Anas Nashif Date: Mon, 5 Nov 2012 19:21:10 +0000 (-0800) Subject: fix whitespace tokenization X-Git-Tag: submit/tizen/20130503.225600~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2cf9bde38908a45ec35fd0d6f6f10ebde00c69f1;p=platform%2Fupstream%2Fmake.git fix whitespace tokenization --- diff --git a/function.c b/function.c index e2f6c8c..680e954 100644 --- a/function.c +++ b/function.c @@ -1133,19 +1133,14 @@ func_sort (char *o, char **argv, const char *funcname UNUSED) /* Find the maximum number of words we'll have. */ t = argv[0]; - wordi = 1; - while (*t != '\0') + wordi = 0; + while ((p = find_next_token (&t, &len)) != 0) { - char c = *(t++); - - if (! isspace ((unsigned char)c)) - continue; - - ++wordi; - - while (isspace ((unsigned char)*t)) - ++t; + ++t; + wordi++; } + if (! wordi) + wordi = 1; words = xmalloc (wordi * sizeof (char *));