aboutsummaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-01-18 09:52:35 -0800
committerBruce Hill <bruce@bruce-hill.com>2021-01-18 09:52:35 -0800
commit7f0c3804dce7591332bbf6bd0922597ea675df44 (patch)
treef165413a246604b61ba6567e626ed54a1d470b04 /utils.h
parent2622d44dc4247766089c2e455d798070b3800b39 (diff)
Checking more return values (per static analyzer)
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/utils.h b/utils.h
index e14ddbe..8080ee5 100644
--- a/utils.h
+++ b/utils.h
@@ -11,7 +11,7 @@
#include "match.h"
#define streq(a, b) (strcmp(a, b) == 0)
-#define check(cond, ...) do { if (!(cond)) { fprintf(stderr, __VA_ARGS__); fwrite("\n", 1, 1, stderr); exit(1); } } while(0)
+#define check(cond, ...) do { if (!(cond)) { (void)fprintf(stderr, __VA_ARGS__); (void)fwrite("\n", 1, 1, stderr); exit(1); } } while(0)
#define new(t) memcheck(calloc(1, sizeof(t)))
#define xcalloc(a,b) memcheck(calloc(a,b))
#define xrealloc(a,b) memcheck(realloc(a,b))
@@ -28,7 +28,8 @@ __attribute__((nonnull))
int matchstr(const char **str, const char *target);
__attribute__((nonnull))
size_t unescape_string(char *dest, const char *src, size_t bufsize);
-void *memcheck(void *p);
+__attribute__((returns_nonnull))
+void *memcheck(/*@null@*/ /*@out@*/ void *p);
__attribute__((nonnull))
int memicmp(const void *s1, const void *s2, size_t n);
__attribute__((nonnull))