Back to index

php5  5.3.10
zend_static_allocator.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | Zend Engine                                                          |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 2.00 of the Zend license,     |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.zend.com/license/2_00.txt.                                |
00011    | If you did not receive a copy of the Zend license and are unable to  |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@zend.com so we can mail you a copy immediately.              |
00014    +----------------------------------------------------------------------+
00015    | Authors: Andi Gutmans <andi@zend.com>                                |
00016    +----------------------------------------------------------------------+
00017 */
00018 
00019 /* $Id: zend_static_allocator.h 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 #ifndef ZEND_STATIC_ALLOCATOR_H
00022 #define ZEND_STATIC_ALLOCATOR_H
00023 
00024 #define ALLOCATOR_BLOCK_SIZE 400000
00025 
00026 /* Temporary */
00027 typedef unsigned int zend_uint;
00028 #define emalloc(s) malloc(s)
00029 #define efree(p) free(p)
00030 
00031 typedef struct _Block {
00032        char *bp;
00033        char *pos;
00034        char *end;
00035 } Block;
00036 
00037 typedef struct _StaticAllocator {
00038        Block *Blocks;
00039        zend_uint num_blocks;
00040        zend_uint current_block;
00041 } StaticAllocator;
00042 
00043 void static_allocator_init(StaticAllocator *sa);
00044 char *static_allocator_allocate(StaticAllocator *sa, zend_uint size);
00045 void static_allocator_destroy(StaticAllocator *sa);
00046 
00047 #endif /* ZEND_STATIC_ALLOCATOR_H */
00048 
00049 /*
00050  * Local variables:
00051  * tab-width: 4
00052  * c-basic-offset: 4
00053  * indent-tabs-mode: t
00054  * End:
00055  */