diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-18 09:52:35 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-18 09:52:35 -0800 |
| commit | 7f0c3804dce7591332bbf6bd0922597ea675df44 (patch) | |
| tree | f165413a246604b61ba6567e626ed54a1d470b04 /utils.h | |
| parent | 2622d44dc4247766089c2e455d798070b3800b39 (diff) | |
Checking more return values (per static analyzer)
Diffstat (limited to 'utils.h')
| -rw-r--r-- | utils.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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)) |
