[PATCH 1/2] extract replace_with_bool() from replace_with_defined()

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

 



so that it can be reused for similar boolean evaluated macros.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 pre-process.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/pre-process.c b/pre-process.c
index 7d335ab0c..7bc4a00fd 100644
--- a/pre-process.c
+++ b/pre-process.c
@@ -145,13 +145,17 @@ static int token_defined(struct token *token)
 	return 0;
 }
 
-static void replace_with_defined(struct token *token)
+static void replace_with_bool(struct token *token, bool val)
 {
 	static const char *string[] = { "0", "1" };
-	int defined = token_defined(token);
 
 	token_type(token) = TOKEN_NUMBER;
-	token->number = string[defined];
+	token->number = string[val];
+}
+
+static void replace_with_defined(struct token *token)
+{
+	replace_with_bool(token, token_defined(token));
 }
 
 static int expand_one_symbol(struct token **list)
-- 
2.17.1

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