Remove turn_calloc()

Do not overload calloc() from stdlib.h
This commit is contained in:
Bradley T. Hughes 2019-03-07 07:08:31 +01:00
parent b50fc77124
commit abab870070
3 changed files with 1 additions and 16 deletions

View File

@ -787,18 +787,6 @@ void tm_print_func(void) {
pthread_mutex_unlock(&tm);
}
extern "C" void *turn_calloc_func(size_t number, size_t size, const char* function, int line);
void *turn_calloc_func(size_t number, size_t size, const char* function, int line) {
TM_START();
void *ptr = calloc(number,size);
add_tm_ptr(ptr,id);
return ptr;
}
extern "C" char *turn_strdup_func(const char* s, const char* function, int line);
char *turn_strdup_func(const char* s, const char* function, int line) {

View File

@ -118,7 +118,6 @@ static inline u64bits _ioa_ntoh64(u64bits v)
#define TURN_LOG_FUNC(level, ...) printf (__VA_ARGS__)
void tm_print_func(void);
void *turn_calloc_func(size_t number, size_t size, const char* function, int line);
char *turn_strdup_func(const char* s, const char* function, int line);
void* debug_ptr_add_func(void *ptr, const char* function, int line);
void debug_ptr_del_func(void *ptr, const char* function, int line);
@ -126,7 +125,6 @@ static inline u64bits _ioa_ntoh64(u64bits v)
#define debug_ptr_add(ptr) debug_ptr_add_func((ptr),__FUNCTION__,__LINE__)
#define debug_ptr_del(ptr) debug_ptr_del_func((ptr),__FUNCTION__,__LINE__)
#define tm_print() tm_print_func()
#define turn_calloc(number, sz) turn_calloc_func((number),(size_t)(sz),__FUNCTION__,__LINE__)
#define turn_strdup(s) turn_strdup_func((s),__FUNCTION__,__LINE__)
#define SSL_NEW(ctx) ((SSL*)debug_ptr_add(SSL_new(ctx)))
@ -136,7 +134,6 @@ static inline u64bits _ioa_ntoh64(u64bits v)
#define debug_ptr_add(ptr)
#define debug_ptr_del(ptr)
#define tm_print()
#define turn_calloc(number, sz) calloc((number),(size_t)(sz))
#define turn_strdup(s) strdup((s))
#define SSL_NEW(ctx) SSL_new(ctx)

View File

@ -125,7 +125,7 @@ static const double __ac_HASH_UPPER = 0.77;
khval_t *vals; u32bits vals_size; \
} kh_##name##_t; \
static inline kh_##name##_t *kh_init_##name(void) { \
return (kh_##name##_t*)turn_calloc(1, sizeof(kh_##name##_t)); \
return (kh_##name##_t*)calloc(1, sizeof(kh_##name##_t)); \
} \
static inline void kh_destroy_##name(kh_##name##_t *h) \
{ \