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