30 if (newpos < len) { errno = ENOMEM;
return -1; }
51 if (posplus(c,8) == -1)
return -1;
52 if (posplus(c,keylen) == -1)
return -1;
53 if (posplus(c,datalen) == -1)
return -1;
61 if (keylen > 0xffffffff) { errno = ENOMEM;
return -1; }
62 if (datalen > 0xffffffff) { errno = ENOMEM;
return -1; }
90 for (i = 0; i < 256; ++i)
100 for (i = 0; i < 256; ++i) {
108 u /=
sizeof(
struct cdb_hp);
109 if (memsize > u) { errno = ENOMEM;
return -1; }
112 if (!c->
split)
return -1;
117 for (i = 0; i < 256; ++i) {
128 for (i = 0; i < 256; ++i) {
135 for (u = 0; u < len; ++u)
139 for (u = 0; u < count; ++u) {
140 where = (hp->
h >> 8) % len;
141 while (c->
hash[where].
p)
144 c->
hash[where] = *hp++;
147 for (u = 0; u < len; ++u) {
151 if (posplus(c,8) == -1)
return -1;
int cdb_make_start(struct cdb_make *c, int fd)
int cdb_make_finish(struct cdb_make *c)
int cdb_make_addbegin(struct cdb_make *c, unsigned int keylen, unsigned int datalen)
int cdb_make_addend(struct cdb_make *c, unsigned int keylen, unsigned int datalen, uint32 h)
int cdb_make_add(struct cdb_make *c, char *key, unsigned int keylen, char *data, unsigned int datalen)
void * alloc(unsigned int)
uint32 cdb_hash(char *, unsigned int)
void uint32_pack(char *, uint32)
int buffer_putflush(buffer *, const char *, size_t)
int buffer_putalign(buffer *, const char *, size_t)
int buffer_flush(buffer *)
void buffer_init(buffer *, ssize_t(*op)(), int, char *, size_t)
int seek_set(int, seek_pos)
struct cdb_hp hp[CDB_HPLIST]