[PATCH] tokenize.c: Simplify drop_stream_eoln().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simplifying function drop_stream_eoln().

Signed-off-by: Richard Knutsson <ricknu-0@xxxxxxxxxxxxxx>
---
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);
+		}
 	}
 }
 

-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux