Using `calloc` function with a count of zero elements is implementation defined and it may cause allocation errors on some platforms (ref #3277). This commit fixes `jv_mem_calloc` callers to avoid undefined behavior.
16 lines
396 B
C
16 lines
396 B
C
#ifndef JV_ALLOC_H
|
|
#define JV_ALLOC_H
|
|
|
|
#include <stddef.h>
|
|
|
|
void* jv_mem_alloc(size_t);
|
|
void* jv_mem_alloc_unguarded(size_t);
|
|
void* jv_mem_calloc(size_t, size_t);
|
|
void* jv_mem_calloc_unguarded(size_t, size_t);
|
|
char* jv_mem_strdup(const char *);
|
|
char* jv_mem_strdup_unguarded(const char *);
|
|
void jv_mem_free(void*);
|
|
__attribute__((warn_unused_result)) void* jv_mem_realloc(void*, size_t);
|
|
|
|
#endif
|