Skip to content

Commit

Permalink
Silence -Wstrict-prototypes and static analyser warnings
Browse files Browse the repository at this point in the history
Using "(void)" provides an explicit there-are-no-arguments prototype.
Using the exact type in "malloc(...sizeof)" is clearer and silences
warnings from clang's static analyzer.
  • Loading branch information
jmarshall committed Apr 9, 2014
1 parent 2818c5c commit f79c916
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions klist.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
size_t cnt, n, max; \
kmptype_t **buf; \
} kmp_##name##_t; \
static inline kmp_##name##_t *kmp_init_##name() { \
static inline kmp_##name##_t *kmp_init_##name(void) { \
return calloc(1, sizeof(kmp_##name##_t)); \
} \
static inline void kmp_destroy_##name(kmp_##name##_t *mp) { \
Expand All @@ -52,7 +52,7 @@
--mp->cnt; \
if (mp->n == mp->max) { \
mp->max = mp->max? mp->max<<1 : 16; \
mp->buf = realloc(mp->buf, sizeof(void*) * mp->max); \
mp->buf = realloc(mp->buf, sizeof(kmptype_t *) * mp->max); \
} \
mp->buf[mp->n++] = p; \
}
Expand All @@ -75,7 +75,7 @@
kmp_##name##_t *mp; \
size_t size; \
} kl_##name##_t; \
static inline kl_##name##_t *kl_init_##name() { \
static inline kl_##name##_t *kl_init_##name(void) { \
kl_##name##_t *kl = calloc(1, sizeof(kl_##name##_t)); \
kl->mp = kmp_init(name); \
kl->head = kl->tail = kmp_alloc(name, kl->mp); \
Expand Down

0 comments on commit f79c916

Please sign in to comment.