summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-10-12 15:54:54 +0000
committerUlrich Drepper <drepper@redhat.com>2007-10-12 15:54:54 +0000
commitd074d36dde3140ba9b09555760dcbd503405d0f3 (patch)
tree7f98e9e2193c8fb7ae05cd4417fa18748acbb8f5
parent26a51060b10e284231ff73197957cbff52970159 (diff)
downloadglibc-d074d36dde3140ba9b09555760dcbd503405d0f3.tar.gz
glibc-d074d36dde3140ba9b09555760dcbd503405d0f3.tar.xz
glibc-d074d36dde3140ba9b09555760dcbd503405d0f3.zip
* locale/programs/ld-collate.c (collate_read): Optimize a bit.
	(skip_to): Fix problems with parameter of elifdef/elifndef.
-rw-r--r--ChangeLog5
-rw-r--r--locale/programs/ld-collate.c33
2 files changed, 21 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d43d5adb0..ea3bcab117 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-10-12  Ulrich Drepper  <drepper@redhat.com>
+
+	* locale/programs/ld-collate.c (collate_read): Optimize a bit.
+	(skip_to): Fix problems with parameter of elifdef/elifndef.
+
 2007-10-11  Ulrich Drepper  <drepper@redhat.com>
 
 	* iconv/gconv_simple.c: Add some branch prediction.
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 145a27f71a..bf22a2c47b 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -2662,13 +2662,16 @@ skip_to (struct linereader *ldfile, struct locale_collate_t *collate,
 	  if (nowtok == tok_eof || nowtok == tok_end)
 	    return nowtok;
 	}
-      else if ((!to_endif && (nowtok == tok_else || nowtok == tok_elifdef
-			      || nowtok == tok_elifndef))
-	       || nowtok == tok_endif)
+      else if (nowtok == tok_endif || (!to_endif && nowtok == tok_else))
 	{
 	  lr_ignore_rest (ldfile, 1);
 	  return nowtok;
 	}
+      else if (!to_endif && (nowtok == tok_elifdef || nowtok == tok_elifndef))
+	{
+	  /* Do not read the rest of the line.  */
+	  return nowtok;
+	}
       else if (nowtok == tok_else)
 	{
 	  lr_error (ldfile, _("%s: more then one 'else'"), "LC_COLLATE");
@@ -2709,15 +2712,18 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
   /* The rest of the line containing `LC_COLLATE' must be free.  */
   lr_ignore_rest (ldfile, 1);
 
-  do
+  while (1)
     {
-      now = lr_token (ldfile, charmap, result, NULL, verbose);
-      nowtok = now->tok;
-    }
-  while (nowtok == tok_eol);
+      do
+	{
+	  now = lr_token (ldfile, charmap, result, NULL, verbose);
+	  nowtok = now->tok;
+	}
+      while (nowtok == tok_eol);
+
+      if (nowtok != tok_define)
+	break;
 
-  while (nowtok == tok_define)
-    {
       if (ignore_content)
 	lr_ignore_rest (ldfile, 0);
       else
@@ -2738,13 +2744,6 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
 	      lr_ignore_rest (ldfile, 1);
 	    }
 	}
-
-      do
-	{
-	  now = lr_token (ldfile, charmap, result, NULL, verbose);
-	  nowtok = now->tok;
-	}
-      while (nowtok == tok_eol);
     }
 
   if (nowtok == tok_copy)