31 if (newpos < len) { errno = ENOMEM;
return -1; }
52 if (posplus(c,8) == -1)
return -1;
53 if (posplus(c,keylen) == -1)
return -1;
54 if (posplus(c,datalen) == -1)
return -1;
62 if (keylen > 0xffffffff) { errno = ENOMEM;
return -1; }
63 if (datalen > 0xffffffff) { errno = ENOMEM;
return -1; }
91 for (i = 0; i < 256; ++i)
101 for (i = 0; i < 256; ++i) {
109 u /=
sizeof(
struct cdb_hp);
110 if (memsize > u) { errno = ENOMEM;
return -1; }
113 if (!c->
split)
return -1;
118 for (i = 0; i < 256; ++i) {
129 for (i = 0; i < 256; ++i) {
136 for (u = 0; u < len; ++u)
140 for (u = 0; u < count; ++u) {
141 where = (hp->
h >> 8) % len;
142 while (c->
hash[where].
p)
145 c->
hash[where] = *hp++;
148 for (u = 0; u < len; ++u) {
152 if (posplus(c,8) == -1)
return -1;
ssize_t buffer_unixwrite(int, char *, size_t)
void buffer_init(buffer *, ssize_t(*op)(int, char *, size_t), int, char *, size_t)
int buffer_putflush(buffer *, const char *, size_t)
int buffer_putalign(buffer *, const char *, size_t)
int buffer_flush(buffer *)
void uint32_pack(char *, uint32)
int seek_set(int, seek_pos)
uint32 cdb_hash(char *, unsigned int)
void * alloc(unsigned int)
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)
struct cdb_hp hp[CDB_HPLIST]