public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix collate_read
@ 2007-10-11 23:06 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2007-10-11 23:06 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

WHen nowtok == tok_define && ignore_content, lr_ignore_rest only skips
till end of line, but lr_token is not called, which means nowtok is
never updated and we loop forever.  The patch is large only because of
identation changes.

2007-10-12  Jakub Jelinek  <jakub@redhat.com>

	* locale/programs/ld-collate.c (collate_read): If ignore_content
	and nowtok is tok_define, eat any tok_eol tokens.

--- libc/locale/programs/ld-collate.c	2007-10-12 00:19:00.000000000 +0200
+++ libc/locale/programs/ld-collate.c	2007-10-12 00:59:35.000000000 +0200
@@ -2719,25 +2719,24 @@ collate_read (struct linereader *ldfile,
   while (nowtok == tok_define)
     {
       if (ignore_content)
-	{
-	  lr_ignore_rest (ldfile, 0);
-	  continue;
-	}
-
-      arg = lr_token (ldfile, charmap, result, NULL, verbose);
-      if (arg->tok != tok_ident)
-	SYNTAX_ERROR (_("%s: syntax error"), "LC_COLLATE");
+	lr_ignore_rest (ldfile, 0);
       else
 	{
-	  /* Simply add the new symbol.  */
-	  struct name_list *newsym = xmalloc (sizeof (*newsym)
-					  + arg->val.str.lenmb + 1);
-	  memcpy (newsym->str, arg->val.str.startmb, arg->val.str.lenmb);
-	  newsym->str[arg->val.str.lenmb] = '\0';
-	  newsym->next = defined;
-	  defined = newsym;
+	  arg = lr_token (ldfile, charmap, result, NULL, verbose);
+	  if (arg->tok != tok_ident)
+	    SYNTAX_ERROR (_("%s: syntax error"), "LC_COLLATE");
+	  else
+	    {
+	      /* Simply add the new symbol.  */
+	      struct name_list *newsym = xmalloc (sizeof (*newsym)
+						  + arg->val.str.lenmb + 1);
+	      memcpy (newsym->str, arg->val.str.startmb, arg->val.str.lenmb);
+	      newsym->str[arg->val.str.lenmb] = '\0';
+	      newsym->next = defined;
+	      defined = newsym;
 
-	  lr_ignore_rest (ldfile, 1);
+	      lr_ignore_rest (ldfile, 1);
+	    }
 	}
 
       do

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-10-11 23:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-11 23:06 [PATCH] Fix collate_read Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).