framework/st_things : change "malloc" to "things_malloc"
chamge "malloc" to "things_malloc"
chagne "free" to "things_free"
******************************************************************/
#include "st_things_util.h"
+#include "memory/things_malloc.h"
void *util_malloc(size_t size)
{
RET_NULL_IF_PARAM_EXPR_IS_TRUE(size < 1);
- return malloc(size);
+ return things_malloc(size);
}
void *util_calloc(size_t num, size_t size)
@@ -30,12 +31,12 @@ void *util_calloc(size_t num, size_t size)
RET_NULL_IF_PARAM_EXPR_IS_TRUE(num < 1);
RET_NULL_IF_PARAM_EXPR_IS_TRUE(size < 1);
- return calloc(num, size);
+ return things_calloc(num, size);
}
void util_free(void *ptr)
{
- free(ptr);
+ things_free(ptr);
}
char *util_clone_string(const char *str)
@@ -43,7 +44,7 @@ char *util_clone_string(const char *str)
RET_NULL_IF_PARAM_IS_NULL(str);
int len = strlen(str);
- char *dest_str = (char *)util_malloc(sizeof(char) *len + 1);
+ char *dest_str = (char *)things_malloc(sizeof(char) *len + 1);
if (NULL != dest_str) {
strncpy(dest_str, str, len + 1);
} else {
@@ -59,7 +60,7 @@ void util_free_str_array(char **ptr, size_t size)
RET_IF_PARAM_EXPR_IS_TRUE(size < 1);
for (size_t index = 0; index < size; index++) {
- free(ptr[index]);
+ things_free(ptr[index]);
}
- free(ptr);
+ things_free(ptr);
}
