diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-06-08 03:38:29 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-06-08 18:53:19 +0200 |
| commit | 35b50cdb51b6c32262103672277135cb0b5311e6 (patch) | |
| tree | 97384af56029f817a154eb906bfac1868e542854 | |
| parent | da8d67b5bba6812c390a53ad6cb4ef4b64f4d1dc (diff) | |
| download | sparse-dev-35b50cdb51b6c32262103672277135cb0b5311e6.tar.gz | |
extract replace_with_bool() from replace_with_defined()
so that it can be reused for similar boolean evaluated macros.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | pre-process.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pre-process.c b/pre-process.c index 88be02f1..b44231fd 100644 --- a/pre-process.c +++ b/pre-process.c @@ -146,13 +146,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 void expand_line(struct token *token) |
