From 9f00ff9a91026e3cb1c34e54f0449c4fd5910faa Mon Sep 17 00:00:00 2001 From: Jonathan Fether Date: Thu, 27 Oct 2016 20:02:44 -0700 Subject: [PATCH] Remove redundant test from cJSON_AddItemToArray The test for whether "c" is null is redundant. Since this is the else case of "(!c)", and the only way "c" is changed is by the instruction assigning it "c->next" on the condition here, simply verifying that "c->next" isn't null is sufficient. --- cJSON.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index 36d9233..62fd4bc 100644 --- a/cJSON.c +++ b/cJSON.c @@ -1658,7 +1658,7 @@ void cJSON_AddItemToArray(cJSON *array, cJSON *item) else { /* append to the end */ - while (c && c->next) + while (c->next) { c = c->next; } -- GitLab