cdb_make.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 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. /* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
  19. #ifndef CDB_MAKE_H
  20. #define CDB_MAKE_H
  21. #include <stdio.h>
  22. #include "uint32.h"
  23. #define CDB_HPLIST 1000
  24. struct cdb_hp {
  25. uint32 h;
  26. uint32 p;
  27. };
  28. struct cdb_hplist {
  29. struct cdb_hp hp[CDB_HPLIST];
  30. struct cdb_hplist *next;
  31. int num;
  32. } ;
  33. struct cdb_make {
  34. /* char bspace[8192]; */
  35. char final[2048];
  36. uint32 count[256];
  37. uint32 start[256];
  38. struct cdb_hplist *head;
  39. struct cdb_hp *split; /* includes space for hash */
  40. struct cdb_hp *hash;
  41. uint32 numentries;
  42. /* buffer b; */
  43. uint32 pos;
  44. /* int fd; */
  45. php_stream * fp;
  46. };
  47. int cdb_make_start(struct cdb_make *, php_stream *);
  48. int cdb_make_addbegin(struct cdb_make *, unsigned int, unsigned int);
  49. int cdb_make_addend(struct cdb_make *, unsigned int, unsigned int, uint32);
  50. int cdb_make_add(struct cdb_make *, char *, unsigned int, char *, unsigned int);
  51. int cdb_make_finish(struct cdb_make *);
  52. char *cdb_make_version();
  53. #endif