summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-10-26 09:35:38 +0100
committerLars Wirzenius <liw@liw.fi>2010-10-26 09:35:38 +0100
commit32467c0e8782b442c41069172d362e93ef878191 (patch)
treec32e93a99072ea2a998323c6d864e7e0b07ed57f
parentbc430e9f80e622833faeea7252d6ba5aa5552bcb (diff)
downloaddynstr-32467c0e8782b442c41069172d362e93ef878191.tar.gz
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.
-rw-r--r--dynstr.c4
-rw-r--r--unittests.c8
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);