From 0d078d714869d268cdb867ddb3c2c5e20eec36ea Mon Sep 17 00:00:00 2001
From: Přemysl Janouch 
Date: Wed, 24 May 2017 20:54:37 +0200
Subject: Simplify truthy()
---
 ell.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/ell.c b/ell.c
index 7dd3ffa..accfb1e 100644
--- a/ell.c
+++ b/ell.c
@@ -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); }
-- 
cgit v1.2.3-70-g09d2