diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2017-05-24 20:54:37 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2017-05-24 20:54:37 +0200 |
commit | 0d078d714869d268cdb867ddb3c2c5e20eec36ea (patch) | |
tree | fed2ccc3a8a6b62140ad44bbe2add60c592703e1 | |
parent | a81d75164a9746f93f7db18af9bf9afc68d19a49 (diff) | |
download | ell-0d078d714869d268cdb867ddb3c2c5e20eec36ea.tar.gz ell-0d078d714869d268cdb867ddb3c2c5e20eec36ea.tar.xz ell-0d078d714869d268cdb867ddb3c2c5e20eec36ea.zip |
Simplify truthy()
-rw-r--r-- | ell.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -211,7 +211,6 @@ struct lexer { struct buffer string; ///< Parsed string value }; -/// Input has to be null-terminated anyway static void lexer_init (struct lexer *self, const char *p, size_t len) { *self = (struct lexer) { .p = (const unsigned char *) p, .len = len }; @@ -886,8 +885,7 @@ new_number (double n) { static bool truthy (struct item *item) { - return item - && ((item->type == ITEM_STRING && item->len != 0) || item->head); + return item && (item->head || item->len); } static struct item * new_boolean (bool b) { return new_string ("1", b); } |