]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
msgfmt: Simplify LINGUAS parsing
authorDaiki Ueno <ueno@gnu.org>
Thu, 17 Apr 2014 02:32:53 +0000 (11:32 +0900)
committerDaiki Ueno <ueno@gnu.org>
Thu, 17 Apr 2014 02:52:33 +0000 (11:52 +0900)
gettext-tools/src/msgfmt.c

index 46369204ecd539596ecf1fc1d0b971408c587d1c..57986b9a61b10cc55e1d8691dae7f89b810a9521 100644 (file)
@@ -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;
             }
         }