From: Daiki Ueno Date: Thu, 17 Apr 2014 02:32:53 +0000 (+0900) Subject: msgfmt: Simplify LINGUAS parsing X-Git-Tag: v0.19~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfac1548;p=thirdparty%2Fgettext.git msgfmt: Simplify LINGUAS parsing --- diff --git a/gettext-tools/src/msgfmt.c b/gettext-tools/src/msgfmt.c index 46369204e..57986b9a6 100644 --- a/gettext-tools/src/msgfmt.c +++ b/gettext-tools/src/msgfmt.c @@ -1345,25 +1345,21 @@ get_languages (const char *directory) continue; /* Split the line by whitespace and build the languages list. */ - start = line_buf; - while (*start != '\0') + for (start = line_buf; start - line_buf < len; ) { - char *end = start; - int c; + char *p; - while (*end != '\0' && *end != ' ' && *end != '\t') - end++; - - c = *end; - *end = '\0'; - string_list_append_unique (languages, start); - - if (c == '\0') - break; - - start = end + 1; + /* Skip whitespace before the string. */ while (*start == ' ' || *start == '\t') start++; + + p = start; + while (*p != ' ' && *p != '\t') + p++; + + *p = '\0'; + string_list_append_unique (languages, start); + start = p + 1; } }