root/Zend/zend_static_allocator.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2    +----------------------------------------------------------------------+
   3    | Zend Engine                                                          |
   4    +----------------------------------------------------------------------+
   5    | Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
   6    +----------------------------------------------------------------------+
   7    | This source file is subject to version 2.00 of the Zend license,     |
   8    | that is bundled with this package in the file LICENSE, and is        |
   9    | available through the world-wide-web at the following url:           |
  10    | http://www.zend.com/license/2_00.txt.                                |
  11    | If you did not receive a copy of the Zend license and are unable to  |
  12    | obtain it through the world-wide-web, please send a note to          |
  13    | license@zend.com so we can mail you a copy immediately.              |
  14    +----------------------------------------------------------------------+
  15    | Authors: Andi Gutmans <andi@zend.com>                                |
  16    +----------------------------------------------------------------------+
  17 */
  18 
  19 /* $Id$ */
  20 
  21 #ifndef ZEND_STATIC_ALLOCATOR_H
  22 #define ZEND_STATIC_ALLOCATOR_H
  23 
  24 #define ALLOCATOR_BLOCK_SIZE 400000
  25 
  26 /* Temporary */
  27 typedef unsigned int zend_uint;
  28 #define emalloc(s) malloc(s)
  29 #define efree(p) free(p)
  30 
  31 typedef struct _Block {
  32         char *bp;
  33         char *pos;
  34         char *end;
  35 } Block;
  36 
  37 typedef struct _StaticAllocator {
  38         Block *Blocks;
  39         zend_uint num_blocks;
  40         zend_uint current_block;
  41 } StaticAllocator;
  42 
  43 void static_allocator_init(StaticAllocator *sa);
  44 char *static_allocator_allocate(StaticAllocator *sa, zend_uint size);
  45 void static_allocator_destroy(StaticAllocator *sa);
  46 
  47 #endif /* ZEND_STATIC_ALLOCATOR_H */
  48 
  49 /*
  50  * Local variables:
  51  * tab-width: 4
  52  * c-basic-offset: 4
  53  * indent-tabs-mode: t
  54  * End:
  55  */

/* [<][>][^][v][top][bottom][index][help] */