diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2016-12-29 14:46:34 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2016-12-29 14:46:34 +0100 |
commit | 0fc0c19e4dc2b4ec2f175744e1ac468643b6da71 (patch) | |
tree | 9d94f090d900e17cd29a5b08654f3d3d97ba9de0 | |
parent | cb4a70a049f2df4b6ffaa5f7fb5f920910bd1d68 (diff) | |
download | hktool-0fc0c19e4dc2b4ec2f175744e1ac468643b6da71.tar.gz hktool-0fc0c19e4dc2b4ec2f175744e1ac468643b6da71.tar.xz hktool-0fc0c19e4dc2b4ec2f175744e1ac468643b6da71.zip |
eprintf: Add asserts
-rw-r--r-- | eprintf.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1,9 +1,10 @@ +#include <assert.h> #include <errno.h> #include <stdarg.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <stdint.h> #include "eprintf.h" @@ -15,6 +16,8 @@ void eprintf(const char *fmt, ...) int errnum = errno; va_list va; + assert(fmt); + if (progname() != NULL) fprintf(stderr, "%s: ", progname()); @@ -35,6 +38,8 @@ void weprintf(const char *fmt, ...) int errnum = errno; va_list va; + assert(fmt); + if (progname() != NULL) fprintf(stderr, "%s: ", progname()); @@ -53,6 +58,8 @@ char *estrdup(const char *s) size_t len; char *dup; + assert(s); + len = strlen(s); if (len == SIZE_MAX) eprintf("estrdup(\"%.20s\") failed: Too long", s); |