From 5bd661bc5c9a1ee8a627b5aa07b791703a3369d8 Mon Sep 17 00:00:00 2001 From: zoanana990 Date: Wed, 28 Feb 2024 22:17:39 +0800 Subject: [PATCH 1/2] Remove redundant condition --- src/lexer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lexer.c b/src/lexer.c index 05a67ea5..1751ee04 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -119,7 +119,7 @@ int is_alnum(char c) int is_digit(char c) { - return (c >= '0' && c <= '9') ? 1 : 0; + return (c >= '0' && c <= '9'); } int is_hex(char c) From c818075e8ff887b81777387805245d294199626b Mon Sep 17 00:00:00 2001 From: zoanana990 Date: Thu, 29 Feb 2024 12:51:05 +0800 Subject: [PATCH 2/2] Remove redundant parentheses --- src/lexer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lexer.c b/src/lexer.c index 1751ee04..8239a7cd 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -94,7 +94,7 @@ int macro_return_idx; int is_whitespace(char c) { - return (c == ' ' || c == '\t'); + return c == ' ' || c == '\t'; } char peek_char(int offset); @@ -107,7 +107,7 @@ int is_linebreak(char c) int is_newline(char c) { - return (c == '\r' || c == '\n'); + return c == '\r' || c == '\n'; } /* is it alphabet, number or '_'? */ @@ -119,7 +119,7 @@ int is_alnum(char c) int is_digit(char c) { - return (c >= '0' && c <= '9'); + return c >= '0' && c <= '9'; } int is_hex(char c)