ks_malloc.c

Go to the documentation of this file.
00001 /*
00002  * libkarmaclient - A C Library to the Karmasphere Reputation Server
00003  * Copyright (C) 2006 Karmasphere <http://www.karmasphere.com/>
00004  *  - Shevek <shevek@karmasphere.com>
00005  *  - Dave Stewart <dave.stewart@karmasphere.com>
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020  */
00021 
00031 #include "ks_config.h"
00032 #include "ks_malloc.h"
00033 
00034 #ifdef HAVE_STDLIB_H
00035 #include <stdlib.h>
00036 #endif
00037 
00059 static ks_malloc_t      _ks_malloc = malloc;
00060 static ks_realloc_t     _ks_realloc = realloc;
00061 static ks_free_t        _ks_free = free;
00062 
00074 void
00075 ks_malloc_set(ks_malloc_t m, ks_realloc_t r, ks_free_t f)
00076 {
00077         _ks_malloc = m;
00078         _ks_realloc = r;
00079         _ks_free = f;
00080 }
00081 
00091 void *
00092 ks_malloc(size_t size)
00093 {
00094         return _ks_malloc(size);
00095 }
00096 
00108 void *
00109 ks_realloc(void *ptr, size_t size)
00110 {
00111         return _ks_realloc(ptr, size);
00112 }
00113 
00121 void
00122 ks_free(void *ptr)
00123 {
00124         _ks_free(ptr);
00125 }

Generated on Wed May 9 01:01:56 2007 for libkarmaclient by  doxygen 1.5.1