linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tokenize.c: Simplify drop_stream_eoln().
@ 2007-07-19  0:01 ricknu-0
  2007-07-29  8:13 ` Josh Triplett
  0 siblings, 1 reply; 2+ messages in thread
From: ricknu-0 @ 2007-07-19  0:01 UTC (permalink / raw)
  To: linux-sparse

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);
+		}
 	}
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tokenize.c: Simplify drop_stream_eoln().
  2007-07-19  0:01 [PATCH] tokenize.c: Simplify drop_stream_eoln() ricknu-0
@ 2007-07-29  8:13 ` Josh Triplett
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Triplett @ 2007-07-29  8:13 UTC (permalink / raw)
  To: ricknu-0; +Cc: linux-sparse

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

ricknu-0@student.ltu.se wrote:
> 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()?

None that I know of, and your patch doesn't break the test suite.  Applied;
thanks!

- Josh Triplett



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-29  8:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-19  0:01 [PATCH] tokenize.c: Simplify drop_stream_eoln() ricknu-0
2007-07-29  8:13 ` Josh Triplett

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).