31 #include <yaz/xmalloc.h>
67 for (i = 0; i<
len; i++)
68 h = h * 65509 +
buf[i];
69 for (j = 0; j<
key->
len; j++)
100 p->
nmem = nmem_create();
126 p->
buf = xmalloc(sz);
154 nmem_destroy(p->
nmem);
159 const char *str,
size_t slen,
168 if (slen == e->
len && !memcmp(str, e->
buf, slen) &&
172 e->
next = *kep_first;
179 *kep = nmem_malloc(keys->
nmem,
sizeof(**kep));
182 memcpy(&(*kep)->key,
key,
sizeof(*
key));
183 (*kep)->buf = nmem_malloc(keys->
nmem, slen);
184 memcpy((*kep)->buf, str, slen);
189 const char *str,
size_t slen,
193 const char *src = (
char*)
key;
205 yaz_log(YLOG_LOG,
"dup key slen=%d %.*s "
214 char *b = (
char *) xmalloc (keys->
buf_max += 128000);
224 memcpy (dst, str, slen);
260 const char **str,
size_t *slen,
269 char *dst = (
char*)
key;
void iscz1_decode(void *vp, char **dst, const char **src)
void iscz1_encode(void *vp, char **dst, const char **src)
int key_compare(const void *p1, const void *p2)
void iscz1_reset(void *vp)
int zebra_rec_keys_empty(zebra_rec_keys_t keys)
int zebra_rec_keys_read(zebra_rec_keys_t keys, const char **str, size_t *slen, struct it_key *key)
void zebra_rec_keys_reset(zebra_rec_keys_t keys)
void zebra_rec_keys_get_buf(zebra_rec_keys_t p, char **buf, size_t *sz)
int zebra_rec_keys_add_hash(zebra_rec_keys_t keys, const char *str, size_t slen, const struct it_key *key)
int zebra_rec_keys_rewind(zebra_rec_keys_t keys)
zint zebra_rec_keys_get_custom_record_id(zebra_rec_keys_t keys)
struct zebra_rec_key_entry ** zebra_rec_keys_mk_hash(zebra_rec_keys_t p, const char *buf, size_t len, const struct it_key *key)
zebra_rec_keys_t zebra_rec_keys_open(void)
void zebra_rec_keys_set_buf(zebra_rec_keys_t p, char *buf, size_t sz, int copy_buf)
void zebra_rec_keys_write(zebra_rec_keys_t keys, const char *str, size_t slen, const struct it_key *key)
void zebra_rec_keys_close(zebra_rec_keys_t p)
static void init_hash(zebra_rec_keys_t p)
zint mem[IT_KEY_LEVEL_MAX]
struct zebra_rec_key_entry * next
struct zebra_rec_key_entry ** entries
#define CAST_ZINT_TO_INT(x)