From 32467c0e8782b442c41069172d362e93ef878191 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 26 Oct 2010 09:35:38 +0100 Subject: Change calls to dynstr_cat to use (void*)NULL instead of plain NULL. This avoids problems when NULL is #defined as 0, and is being used in a variable argument list. Thanks to Richard Braakman for pointing this out. --- dynstr.c | 4 ++-- unittests.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dynstr.c b/dynstr.c index d4ae012..e5f6878 100644 --- a/dynstr.c +++ b/dynstr.c @@ -446,7 +446,7 @@ static Dynstr *readline_helper(int (*callback)(FILE *, int), FILE *f, int fd) temp1 = dynstr_new_from_memory(buf, buflen); if (temp1 == NULL) goto error; - temp2 = dynstr_cat(line, temp1, NULL); + temp2 = dynstr_cat(line, temp1, (void *) NULL); if (temp2 == NULL) goto error; dynstr_free(temp1); @@ -463,7 +463,7 @@ static Dynstr *readline_helper(int (*callback)(FILE *, int), FILE *f, int fd) temp1 = dynstr_new_from_memory(buf, buflen); if (temp1 == NULL) goto error; - temp2 = dynstr_cat(line, temp1, NULL); + temp2 = dynstr_cat(line, temp1, (void *) NULL); if (temp2 == NULL) goto error; dynstr_free(temp1); diff --git a/unittests.c b/unittests.c index a0d84c8..2b6c058 100644 --- a/unittests.c +++ b/unittests.c @@ -525,7 +525,7 @@ static int test_cats_ok(void) a = new_from_cstring("abc"); b = new_from_cstring("def"); - c = dynstr_cat(a, b, NULL); + c = dynstr_cat(a, b, (void *) NULL); size = dynstr_memcpy(buf, c, 0, dynstr_len(c)); FAIL_UNLESS_EQUAL(size, 6); FAIL_UNLESS_EQUAL(memcmp(buf, "abcdef", 6), 0); @@ -543,7 +543,7 @@ static int test_cat_returns_NULL_for_first_malloc_failure(void) a = new_from_cstring("abc"); b = new_from_cstring("def"); dynstr_set_malloc(fail_malloc); - c = dynstr_cat(a, b, NULL); + c = dynstr_cat(a, b, (void *) NULL); FAIL_UNLESS_EQUAL(c, NULL); return true; } @@ -559,7 +559,7 @@ static int test_cat_returns_NULL_for_second_malloc_failure(void) b = new_from_cstring("def"); dynstr_set_malloc(fail_malloc); fail_malloc_after = 1; - c = dynstr_cat(a, b, NULL); + c = dynstr_cat(a, b, (void *) NULL); FAIL_UNLESS_EQUAL(c, NULL); return true; } @@ -1131,7 +1131,7 @@ static int readline_test(Dynstr *(*callback)(char *filename)) line1 = dynstr_new_from_constant_cstring(cline1); line2 = dynstr_new_from_constant_cstring(cline2); - lines = dynstr_cat(line1, line2, NULL); + lines = dynstr_cat(line1, line2, (void *) NULL); if (dynstr_write(fd, lines) != dynstr_len(lines)) abort(); close(fd); -- cgit v1.2.1