aboutsummaryrefslogtreecommitdiffstats
path: root/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'helpers')
-rw-r--r--helpers/ChangeLog5
-rw-r--r--helpers/testdfa.c11
2 files changed, 13 insertions, 3 deletions
diff --git a/helpers/ChangeLog b/helpers/ChangeLog
index ce3fd9ca..bd7e5486 100644
--- a/helpers/ChangeLog
+++ b/helpers/ChangeLog
@@ -1,3 +1,8 @@
+2017-06-25 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * testdfa.c (xcalloc): Replace xmalloc+memset with calloc.
+ (xzalloc): Replace xmalloc+memset with xcalloc.
+
2017-04-26 Arnold D. Robbins <arnold@skeeve.com>
* test-build.sh: Allow override of compiler lists. Print
diff --git a/helpers/testdfa.c b/helpers/testdfa.c
index 72b97907..f61d4e26 100644
--- a/helpers/testdfa.c
+++ b/helpers/testdfa.c
@@ -880,8 +880,13 @@ xnmalloc (size_t n, size_t s)
void *
xcalloc(size_t nmemb, size_t size)
{
- void *p = xmalloc (nmemb * size);
- memset(p, '\0', nmemb * size);
+ void *p = calloc (nmemb, size);
+
+ if (p == NULL) {
+ fprintf(stderr, "xcalloc: calloc failed: %s\n", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
return p;
}
@@ -1031,7 +1036,7 @@ xcharalloc (size_t n)
void *
xzalloc (size_t s)
{
- return memset (xmalloc (s), 0, s);
+ return xcalloc (1, s);
}
# endif