13 #include <AvailabilityMacros.h>
16 #define ALIGNMENT sizeof(void *)
19 #if __APPLE__ && defined(MAC_OS_X_VERSION_10_6)
22 #elif __WINDOWS__ && !__CYGWIN__
30 #if __WINDOWS__ && !__CYGWIN__
44 c->pos =
sizeof(
c->final);
47 for (
i = 0;
i < 256;
i++) {
62 #define R_ANEW(x) (x *)cdb_alloc(sizeof(x))
79 u =
c->count[255 &
h] * 2;
94 buf[1] = (
ut8)((vlen)&0xff);
95 buf[2] = (
ut8)((vlen >> 8) & 0xff);
96 buf[3] = (
ut8)((vlen >> 16) & 0xff);
131 memsize =
c->memsize +
c->numentries;
139 c->hash =
c->split +
c->numentries;
141 for (u =
i = 0;
i < 256;
i++) {
146 for (
x =
c->head;
x;
x =
x->next) {
149 c->split[--
c->start[255 &
x->hp[
i].h]] =
x->hp[
i];
153 for (
i = 0;
i < 256;
i++) {
157 for (u = 0; u <
len; u++) {
158 c->hash[u].h =
c->hash[u].p = 0;
160 hp =
c->split +
c->start[
i];
161 for (u = 0; u <
count; u++) {
162 where = (hp->
h >> 8) %
len;
163 while (
c->hash[where].p) {
164 if (++where ==
len) {
168 c->hash[where] = *hp++;
170 for (u = 0; u <
len; u++) {
189 for (
x =
c->head;
x;) {
int buffer_putalign(buffer *s, const char *buf, ut32 len)
int buffer_putflush(buffer *s, const char *buf, ut32 len)
int buffer_flush(buffer *s)
void buffer_init(buffer *s, BufferOp op, int fd, char *buf, ut32 len)
int(* BufferOp)(int, const char *, int)
int cdb_make_start(struct cdb_make *c, int fd)
static int incpos(struct cdb_make *c, ut32 len)
void cdb_alloc_free(void *x)
int cdb_make_addend(struct cdb_make *c, ut32 keylen, ut32 datalen, ut32 h)
int cdb_make_finish(struct cdb_make *c)
int cdb_make_add(struct cdb_make *c, const char *key, ut32 keylen, const char *data, ut32 datalen)
int cdb_make_addbegin(struct cdb_make *c, ut32 keylen, ut32 datalen)
static int pack_kvlen(ut8 *buf, ut32 klen, ut32 vlen)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
RZ_API void Ht_() free(HtName_(Ht) *ht)
void * malloc(size_t size)
#define SDB_CDB_MAX_VALUE
RZ_API ut32 sdb_hash(const char *key)
static void ut32_pack(char s[4], ut32 u)
static int seek_set(int fd, off_t pos)
static const z80_opcode fd[]