/*
* Copyright © 2012 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see .
*
* Author: Benjamin Segovia
*/
#ifndef __CL_ALLOC_H__
#define __CL_ALLOC_H__
#include
/* Return a valid pointer for the requested memory block size */
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__)
/* malloc + memzero */
extern void* cl_calloc(size_t n, size_t elem_size, char* file, int line);
#define CL_CALLOC(N, ELEM_SIZE) cl_calloc(N, ELEM_SIZE, __FILE__, __LINE__)
/* Regular realloc */
extern void* cl_realloc(void *ptr, size_t sz, char* file, int line);
#define CL_REALLOC(PTR, SZ) cl_realloc(PTR, SZ, __FILE__, __LINE__)
/* Free a pointer allocated with cl_*alloc */
extern void cl_free(void *ptr, char* file, int line);
#define CL_FREE(PTR) cl_free(PTR, __FILE__, __LINE__)
/* We count the number of allocation. This function report the number of
* allocation still unfreed
*/
extern void cl_alloc_report_unfreed(void);
#endif /* __CL_ALLOC_H__ */