linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ricknu-0@student.ltu.se
To: linux-sparse@vger.kernel.org
Subject: [PATCH] tokenize.c: Simplify drop_stream_eoln().
Date: Thu, 19 Jul 2007 02:01:28 +0200	[thread overview]
Message-ID: <1184803288.469ea9d82a143@portal.student.luth.se> (raw)

Simplifying function drop_stream_eoln().

Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se>
---
Is there a reason to call nextchar() before drop_token()?

diff --git a/tokenize.c b/tokenize.c
index fbe4c5a..f4c3d18 100644
--- a/tokenize.c
+++ b/tokenize.c
@@ -578,15 +578,14 @@ static int get_string_token(int next, stream_t *stream)
 
 static int drop_stream_eoln(stream_t *stream)
 {
-	int next = nextchar(stream);
 	drop_token(stream);
 	for (;;) {
-		int curr = next;
-		if (curr == EOF)
-			return next;
-		next = nextchar(stream);
-		if (curr == '\n')
-			return next;
+		switch (nextchar(stream)) {
+		case EOF:
+			return EOF;
+		case '\n':
+			return nextchar(stream);
+		}
 	}
 }
 

             reply	other threads:[~2007-07-19  0:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-19  0:01 ricknu-0 [this message]
2007-07-29  8:13 ` [PATCH] tokenize.c: Simplify drop_stream_eoln() Josh Triplett

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=1184803288.469ea9d82a143@portal.student.luth.se \
    --to=ricknu-0@student.ltu.se \
    --cc=linux-sparse@vger.kernel.org \
    /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 NNTP newsgroup(s).