cJSON

mirror of Dave's cJSON
git clone git://git.thc420.xyz/cJSON
Log | Files | Refs | README | LICENSE

commit d992cd46e6483be48c606f78a7781f040b525c44
parent 84b48121bbdc92a88a54fce6d59c8ca37c412031
Author: Max Bruckner <max@maxbruckner.de>
Date:   Tue,  6 Dec 2016 08:47:44 +0700

test: Handle cJSON_PrintPreallocated return values correctly

Diffstat:
Mtest.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test.c b/test.c @@ -123,7 +123,7 @@ static int print_preallocated(cJSON *root) } /* Print to buffer */ - if (cJSON_PrintPreallocated(root, buf, len, 1) != 0) { + if (!cJSON_PrintPreallocated(root, buf, len, 1)) { printf("cJSON_PrintPreallocated failed!\n"); if (strcmp(out, buf) != 0) { printf("cJSON_PrintPreallocated not the same as cJSON_Print!\n"); @@ -140,7 +140,7 @@ static int print_preallocated(cJSON *root) printf("%s\n", buf); /* force it to fail */ - if (cJSON_PrintPreallocated(root, buf_fail, len_fail, 1) == 0) { + if (cJSON_PrintPreallocated(root, buf_fail, len_fail, 1)) { printf("cJSON_PrintPreallocated failed to show error with insufficient memory!\n"); printf("cJSON_Print result:\n%s\n", out); printf("cJSON_PrintPreallocated result:\n%s\n", buf_fail);