Merge klib upstream.

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. (John Marshall)
This commit is contained in:
Justin M. Keyes 2014-05-19 09:17:27 -04:00
parent 4fc6e06465
commit 93f9023b46

View File

@ -37,7 +37,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 xcalloc(1, sizeof(kmp_##name##_t)); \
} \
static inline void kmp_destroy_##name(kmp_##name##_t *mp) { \
@ -56,7 +56,7 @@
--mp->cnt; \
if (mp->n == mp->max) { \
mp->max = mp->max? mp->max<<1 : 16; \
mp->buf = xrealloc(mp->buf, sizeof(void*) * mp->max); \
mp->buf = xrealloc(mp->buf, sizeof(kmptype_t *) * mp->max); \
} \
mp->buf[mp->n++] = p; \
}
@ -79,7 +79,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 = xcalloc(1, sizeof(kl_##name##_t)); \
kl->mp = kmp_init(name); \
kl->head = kl->tail = kmp_alloc(name, kl->mp); \