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EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef ACL_MYMALLOC_INCLUDE_H
|
|
|
|
|
#define ACL_MYMALLOC_INCLUDE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "acl_define.h"
|
|
|
|
|
#include "acl_malloc.h"
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ĺ궨<EFBFBD>壬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ռ<EFBFBD>
|
|
|
|
|
* @param size {size_t} <EFBFBD><EFBFBD><EFBFBD>䳤<EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {void *}
|
|
|
|
|
*/
|
|
|
|
|
#define acl_mymalloc(size) acl_malloc_glue(__FILE__, __LINE__, size)
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ĺ궨<EFBFBD>壬<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ռ<EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param nmemb {size_t} Ԫ<EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param size {size_t} ÿ<EFBFBD><EFBFBD>Ԫ<EFBFBD>صij<EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {void *}
|
|
|
|
|
*/
|
|
|
|
|
#define acl_mycalloc(nmemb, size) acl_calloc_glue(__FILE__, __LINE__, nmemb, size)
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ĺ궨<EFBFBD><EFBFBD>
|
|
|
|
|
* @param ptr {void*} ԭ<EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @param size {size_t} <EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>ʱҪ<EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {void *}
|
|
|
|
|
*/
|
|
|
|
|
#define acl_myrealloc(ptr, size) acl_realloc_glue(__FILE__, __LINE__, (ptr), size)
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>궨<EFBFBD><EFBFBD>
|
|
|
|
|
* @param str {const char*} Դ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {char*} <EFBFBD>µ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_myfree <EFBFBD>ͷ<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
#define acl_mystrdup(str) acl_strdup_glue(__FILE__, __LINE__, (str))
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>궨<EFBFBD>壬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @param str {const char*} Դ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {size_t} <EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* @return {char*} <EFBFBD>µ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_myfree <EFBFBD>ͷ<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
#define acl_mystrndup(str, len) acl_strndup_glue(__FILE__, __LINE__, (str), len)
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>궨<EFBFBD><EFBFBD>
|
|
|
|
|
* @param ptr {const void*} Դ<EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @param len {size_t} Դ<EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @return {void*} <EFBFBD>µ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_myfree <EFBFBD>ͷ<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
#define acl_mymemdup(ptr, len) acl_memdup_glue(__FILE__, __LINE__, (ptr), len)
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ռ<EFBFBD>
|
|
|
|
|
* @param _ptr_ {void*} <EFBFBD><EFBFBD>̬<EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD>ַ
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
#define acl_myfree(_ptr_) do { \
|
2017-03-31 23:04:16 +08:00
|
|
|
|
if (_ptr_) { \
|
|
|
|
|
acl_free_glue(__FILE__, __LINE__, (_ptr_)); \
|
|
|
|
|
(_ptr_) = NULL; \
|
|
|
|
|
} \
|
2014-11-19 00:25:21 +08:00
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* XXX: <EFBFBD><EFBFBD>Ϊ<EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к궨<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴ˺<EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
#define acl_myfree_fn acl_free_fn_glue
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|