public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix collate_read
Date: Thu, 11 Oct 2007 23:06:00 -0000	[thread overview]
Message-ID: <20071011230910.GJ2896@sunsite.mff.cuni.cz> (raw)

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

                 reply	other threads:[~2007-10-11 23:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071011230910.GJ2896@sunsite.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).