From: John Marshall Date: Wed, 9 Apr 2014 12:40:34 +0000 (+0100) Subject: Silence -Wstrict-prototypes and static analyser warnings X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=f79c9162ee00a5d123ad8096b1143dd071dd0578;p=klib.git Silence -Wstrict-prototypes and static analyser warnings 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. --- diff --git a/klist.h b/klist.h index 984bb10..8b33f27 100644 --- a/klist.h +++ b/klist.h @@ -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) { \ @@ -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; \ } @@ -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); \