[fix] fixing up hash str to id template

This commit is contained in:
Al
2017-03-09 00:54:31 -05:00
parent 4c03e563e0
commit 2400122162

View File

@@ -144,6 +144,7 @@ KHASH_STR_INCR(str_uint32, uint32_t)
k = kh_get(name, h, key); \
if (k == kh_end(h)) { \
char *key_copy = strdup(key); \
val_type new_id = (val_type)kh_size(h); \
if (key_copy == NULL) { \
return false; \
} \
@@ -152,8 +153,12 @@ KHASH_STR_INCR(str_uint32, uint32_t)
free(key_copy); \
return false; \
} \
kh_value(h, k) = (val_type)kh_size(h); \
kh_value(h, k) = new_id; \
*val = new_id; \
*exists = false; \
return true; \
} else { \
*exists = true; \
} \
*val = kh_value(h, k); \
return true; \