C Standard Library Extensions  1.1
cxmemory.h
00001 /* $Id: cxmemory.h,v 1.5 2011/02/21 14:15:31 rpalsa Exp $
00002  *
00003  * This file is part of the ESO C Extension Library
00004  * Copyright (C) 2001-2011 European Southern Observatory
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 /*
00022  * $Author: rpalsa $
00023  * $Date: 2011/02/21 14:15:31 $
00024  * $Revision: 1.5 $
00025  * $Name: cpl-6_0 $
00026  */
00027 
00028 #ifndef CX_MEMORY_H
00029 #define CX_MEMORY_H
00030 
00031 #include <cxtypes.h>
00032 
00033 
00034 CX_BEGIN_DECLS
00035 
00036 struct _cx_memory_vtable_ {
00037     cxptr (*malloc) (cxsize);
00038     cxptr (*calloc) (cxsize, cxsize);
00039     cxptr (*realloc) (cxptr, cxsize);
00040     void (*free) (cxptr);
00041 };
00042 
00043 typedef struct _cx_memory_vtable_ cx_memory_vtable;
00044 
00045 
00046 
00047 /*
00048  * Memory allocation functions
00049  */
00050 
00051 void cx_memory_vtable_set(const cx_memory_vtable *);
00052 cxbool cx_memory_is_system_malloc(void);
00053 
00054 cxptr cx_malloc(cxsize);
00055 cxptr cx_malloc_clear(cxsize);
00056 cxptr cx_calloc(cxsize, cxsize);
00057 cxptr cx_realloc(cxptr, cxsize);
00058 void  cx_free(cxptr);
00059 
00060 CX_END_DECLS
00061 
00062 #endif /* CX_MEMORY_H */