diff options
author | Junyan He <junyan.he@intel.com> | 2016-04-22 16:38:24 +0800 |
---|---|---|
committer | Junyan He <junyan.he@intel.com> | 2016-04-22 16:38:24 +0800 |
commit | fc83c0749235c95b00b4fbd8585095b2036c0793 (patch) | |
tree | 7c37d53042ee41883a7ecb53517d3f69aa196700 | |
parent | d39b3d356496c86075001927419ef6b0a4a5b215 (diff) |
alloc
-rw-r--r-- | libclapi/cl_alloc.c | 2 | ||||
-rw-r--r-- | libclapi/cl_alloc.h | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/libclapi/cl_alloc.c b/libclapi/cl_alloc.c index a0bffa2a..cfa7e6cb 100644 --- a/libclapi/cl_alloc.c +++ b/libclapi/cl_alloc.c @@ -131,7 +131,7 @@ LOCAL void* cl_malloc(size_t sz, char* file, int line) return p; } -LOCAL void* cl_aligned_malloc(size_t sz, size_t align, char* file, int line) +LOCAL void* cl_memalign(size_t sz, size_t align, char* file, int line) { void * p = NULL; p = memalign(align, sz); diff --git a/libclapi/cl_alloc.h b/libclapi/cl_alloc.h index 6cd5264c..ec716ee9 100644 --- a/libclapi/cl_alloc.h +++ b/libclapi/cl_alloc.h @@ -22,6 +22,7 @@ #include <stdlib.h> +#define CL_ALLOC_DEBUG 1 #ifdef CL_ALLOC_DEBUG /* Return a valid pointer for the requested memory block size */ @@ -29,8 +30,8 @@ extern void* cl_malloc(size_t sz, char* file, int line); #define CL_MALLOC(SZ) cl_malloc(SZ, __FILE__, __LINE__) /* Aligned malloc */ -extern void* cl_aligned_malloc(size_t sz, size_t align, char* file, int line); -#define CL_ALIGNED_MALLOC(SZ, ALIGN) cl_aligned_malloc(SZ, ALIGN, __FILE__, __LINE__) +extern void* cl_memalign(size_t sz, size_t align, char* file, int line); +#define CL_MEMALIGN(SZ, ALIGN) cl_memalign(SZ, ALIGN, __FILE__, __LINE__) /* malloc + memzero */ extern void* cl_calloc(size_t n, size_t elem_size, char* file, int line); @@ -51,11 +52,11 @@ extern void cl_alloc_report_unfreed(void); #define CL_ALLOC_REPORT_UNFREED() cl_alloc_report_unfreed() extern void cl_alloc_debug_init(void); -#define CL_ALLOC_DEBUG_INIT cl_alloc_debug_init() +#define CL_ALLOC_DEBUG_INIT() cl_alloc_debug_init() #else #define CL_MALLOC(SZ) malloc(SZ) -#define CL_ALIGNED_MALLOC(SZ, ALIGN) memalign(SZ, ALIGN) +#define CL_MEMALIGN(SZ, ALIGN) memalign(SZ, ALIGN) #define CL_CALLOC(N, ELEM_SIZE) calloc(N, ELEM_SIZE) #define CL_REALLOC(PTR, SZ) realloc(PTR, SZ) #define CL_FREE(PTR) free(PTR) |