LC_COLLATE-keywords-ordering
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Sat, 2 Dec 2017 10:07:17 +0000 (10:07 +0000)
committerAurelien Jarno <aurel32@debian.org>
Sat, 2 Dec 2017 10:07:17 +0000 (10:07 +0000)
Be less strict about keywords ordering in LC_COLLATE section, to
ease definition of new scripts.

Submitted upstream: BZ690

# DP: Dpatch author: Denis Barbier
# DP: Patch author: Denis Barbier
# DP: Upstream status: BZ690
# DP: Date: 2006-01-08

Gbp-Pq: Topic locale
Gbp-Pq: Name LC_COLLATE-keywords-ordering.diff

locale/programs/ld-collate.c

index 6b1df918efba6cda2e987f30c8c1918495deb9f2..692326c8657f44a812414af877be0e169e3b0b71 100644 (file)
@@ -2753,14 +2753,23 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
       switch (nowtok)
        {
        case tok_copy:
-         /* Allow copying other locales.  */
+         /* Ignore the rest of the line if we don't need the input of
+            this line.  */
+         if (ignore_content)
+           {
+             lr_ignore_rest (ldfile, 0);
+             break;
+           }
+
          now = lr_token (ldfile, charmap, result, NULL, verbose);
          if (now->tok != tok_string)
            goto err_label;
 
-         if (! ignore_content)
-           load_locale (LC_COLLATE, now->val.str.startmb, repertoire_name,
-                        charmap, result);
+         if (state == 1 || state == 3 || state == 5)
+           goto err_label;
+
+         load_locale (LC_COLLATE, now->val.str.startmb, repertoire_name,
+                      charmap, result);
 
          lr_ignore_rest (ldfile, 1);
          break;
@@ -2774,9 +2783,6 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
              break;
            }
 
-         if (state != 0)
-           goto err_label;
-
          arg = lr_token (ldfile, charmap, result, NULL, verbose);
          if (arg->tok != tok_number)
            goto err_label;
@@ -2797,7 +2803,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
              break;
            }
 
-         if (state != 0)
+         if (state == 1 || state == 3 || state == 5)
            goto err_label;
 
          arg = lr_token (ldfile, charmap, result, repertoire, verbose);
@@ -2844,7 +2850,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
              break;
            }
 
-         if (state != 0 && state != 2)
+         if (state == 1 || state == 3 || state == 5)
            goto err_label;
 
          arg = lr_token (ldfile, charmap, result, repertoire, verbose);
@@ -2910,7 +2916,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
              break;
            }
 
-         if (state != 0 && state != 2)
+         if (state == 1 || state == 3 || state == 5)
            goto err_label;
 
          arg = lr_token (ldfile, charmap, result, repertoire, verbose);
@@ -3056,7 +3062,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
              break;
            }
 
-         if (state != 0)
+         if (state == 1 || state == 3 || state == 5)
            goto err_label;
 
          arg = lr_token (ldfile, charmap, result, repertoire, verbose);
@@ -3177,7 +3183,7 @@ error while adding equivalent collating symbol"));
              break;
            }
 
-         if (state != 0 && state != 1 && state != 2)
+         if (state == 3 || state == 5)
            goto err_label;
          state = 1;
 
@@ -3488,8 +3494,6 @@ error while adding equivalent collating symbol"));
 %s: missing `reorder-end' keyword"), "LC_COLLATE"));
              state = 4;
            }
-         else if (state != 2 && state != 4)
-           goto err_label;
          state = 5;
 
          /* Get the name of the sections we are adding after.  */