3 KHASH_MAP_INIT_STR(str2id, int)
5 void *bcf_build_refhash(bcf_hdr_t *h)
9 hash = kh_init(str2id);
10 for (i = 0; i < h->n_ref; ++i) {
12 k = kh_put(str2id, hash, h->ns[i], &ret); // FIXME: check ret
18 void bcf_str2id_destroy(void *_hash)
20 khash_t(str2id) *hash = (khash_t(str2id)*)_hash;
21 if (hash) kh_destroy(str2id, hash); // Note that strings are not freed.
24 int bcf_str2id(void *_hash, const char *str)
26 khash_t(str2id) *hash = (khash_t(str2id)*)_hash;
29 k = kh_get(str2id, hash, str);
30 return k == kh_end(hash)? -1 : kh_val(hash, k);