1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 7 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1997-2017 The PHP Group | 6 +----------------------------------------------------------------------+ 7 | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt | 11 | If you did not receive a copy of the PHP license and are unable to | 12 | obtain it through the world-wide-web, please send a note to | 13 | license@php.net so we can mail you a copy immediately. | 14 +----------------------------------------------------------------------+ 15 | Author: Marcus Boerger <helly@php.net> | 16 +----------------------------------------------------------------------+ 17 */ 18 19 /* $Id$ */ 20 21 /* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/ 22 23 #ifndef CDB_MAKE_H 24 #define CDB_MAKE_H 25 26 #include <stdio.h> 27 #include "uint32.h" 28 29 #define CDB_HPLIST 1000 30 31 struct cdb_hp { 32 uint32 h; 33 uint32 p; 34 }; 35 36 struct cdb_hplist { 37 struct cdb_hp hp[CDB_HPLIST]; 38 struct cdb_hplist *next; 39 int num; 40 } ; 41 42 struct cdb_make { 43 /* char bspace[8192]; */ 44 char final[2048]; 45 uint32 count[256]; 46 uint32 start[256]; 47 struct cdb_hplist *head; 48 struct cdb_hp *split; /* includes space for hash */ 49 struct cdb_hp *hash; 50 uint32 numentries; 51 /* buffer b; */ 52 uint32 pos; 53 /* int fd; */ 54 php_stream * fp; 55 }; 56 57 int cdb_make_start(struct cdb_make *, php_stream *); 58 int cdb_make_addbegin(struct cdb_make *, unsigned int, unsigned int); 59 int cdb_make_addend(struct cdb_make *, unsigned int, unsigned int, uint32); 60 int cdb_make_add(struct cdb_make *, char *, unsigned int, char *, unsigned int); 61 int cdb_make_finish(struct cdb_make *); 62 char *cdb_make_version(); 63 64 #endif 65