Back to index

php5  5.3.10
mbfl_allocators.c
Go to the documentation of this file.
00001 /*
00002  * "streamable kanji code filter and converter"
00003  * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved.
00004  *
00005  * LICENSE NOTICES
00006  *
00007  * This file is part of "streamable kanji code filter and converter",
00008  * which is distributed under the terms of GNU Lesser General Public 
00009  * License (version 2) as published by the Free Software Foundation.
00010  *
00011  * This software 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 Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with "streamable kanji code filter and converter";
00018  * if not, write to the Free Software Foundation, Inc., 59 Temple Place,
00019  * Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  * The author of this file:
00022  *
00023  */
00024 /*
00025  * The source code included in this files was separated from mbfilter.c
00026  * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file
00027  * mbfilter.c is included in this package .
00028  *
00029  */
00030 
00031 #ifdef HAVE_CONFIG_H
00032 #include "config.h"
00033 #endif
00034 
00035 #ifdef HAVE_STDLIB_H
00036 #include <stdlib.h>
00037 #endif
00038 
00039 #ifdef HAVE_MEMORY_H
00040 #include <memory.h>
00041 #endif
00042 
00043 #ifdef HAVE_STRING_H
00044 #include <string.h>
00045 #endif
00046 
00047 #ifdef HAVE_STRINGS_H
00048 #include <strings.h>
00049 #endif
00050 
00051 #ifdef HAVE_STDDEF_H
00052 #include <stddef.h>
00053 #endif
00054 
00055 #include "mbfl_allocators.h"
00056 
00057 static void *__mbfl__malloc(unsigned int);
00058 static void *__mbfl__realloc(void *, unsigned int);
00059 static void *__mbfl__calloc(unsigned int, unsigned int);
00060 static void __mbfl__free(void *);
00061 
00062 static mbfl_allocators default_allocators = {
00063        __mbfl__malloc,
00064        __mbfl__realloc,
00065        __mbfl__calloc,
00066        __mbfl__free,
00067        __mbfl__malloc,
00068        __mbfl__realloc,
00069        __mbfl__free
00070 };
00071 
00072 mbfl_allocators *__mbfl_allocators = &default_allocators;
00073 
00074 static void *__mbfl__malloc(unsigned int sz)
00075 {
00076        return malloc(sz);
00077 }
00078 
00079 static void *__mbfl__realloc(void *ptr, unsigned int sz)
00080 {
00081        return realloc(ptr, sz);
00082 }
00083 
00084 static void *__mbfl__calloc(unsigned int nelems, unsigned int szelem)
00085 {
00086        return calloc(nelems, szelem);
00087 }
00088 
00089 static void __mbfl__free(void *ptr)
00090 {
00091        free(ptr);
00092 } 
00093