Move alloc.cc to maxbase

Only renames the functions. Macro names are left as is to keep the diff
small.
This commit is contained in:
Esa Korhonen
2018-11-30 15:21:07 +02:00
parent 0c7e737eb7
commit 760f2ff34c
8 changed files with 75 additions and 72 deletions

View File

@ -15,43 +15,10 @@
#include <maxscale/cdefs.h>
#include <stdlib.h>
#include <string.h>
#include <maxbase/alloc.h>
MXS_BEGIN_DECLS
/*
* NOTE: Do not use these functions directly, use the macros below.
*/
// "caller" arg temporarily disabled so that existing code
// using the previous version of mxs_alloc etc. will continue
// to compile.
void* mxs_malloc(size_t size /*, const char *caller*/);
void* mxs_calloc(size_t nmemb, size_t size /*, const char *caller*/);
void* mxs_realloc(void* ptr, size_t size /*, const char *caller*/);
void mxs_free(void* ptr /*, const char *caller*/);
char* mxs_strdup(const char* s /*, const char *caller*/);
char* mxs_strndup(const char* s, size_t n /*, const char *caller*/);
char* mxs_strdup_a(const char* s /*, const char *caller*/);
char* mxs_strndup_a(const char* s, size_t n /*, const char *caller*/);
/*
* NOTE: USE these macros instead of the functions above.
*/
#define MXS_MALLOC(size) mxs_malloc(size /*, __func__*/)
#define MXS_CALLOC(nmemb, size) mxs_calloc(nmemb, size /*, __func__*/)
#define MXS_REALLOC(ptr, size) mxs_realloc(ptr, size /*, __func__*/)
#define MXS_FREE(ptr) mxs_free(ptr /*, __func__*/)
#define MXS_STRDUP(s) mxs_strdup(s /*, __func__*/)
#define MXS_STRNDUP(s, n) mxs_strndup(s, n /*, __func__*/)
#define MXS_STRDUP_A(s) mxs_strdup_a(s /*, __func__*/)
#define MXS_STRNDUP_A(s, n) mxs_strndup_a(s, n /*, __func__*/)
/**
* @brief Abort the process if the pointer is NULL.
*