Two bugs reported by istreeter and wanghc78

This commit is contained in:
Heng Li 2013-01-26 18:09:06 -05:00
parent 15ddda3d9d
commit 7aa0927bb0

6
kvec.h
View File

@ -81,10 +81,10 @@ int main() {
(v).a = (type*)realloc((v).a, sizeof(type) * (v).m), 0) \
: 0), ((v).a + ((v).n++))
#define kv_a(type, v, i) ((v).m <= (size_t)(i)? \
#define kv_a(type, v, i) (((v).m <= (size_t)(i)? \
((v).m = (v).n = (i) + 1, kv_roundup32((v).m), \
(v).a = (type*)realloc((v).a, sizeof(type) * (v).m), 0) \
: (v).n <= (size_t)(i)? (v).n = (i) \
: 0), (v).a[(i)]
: (v).n <= (size_t)(i)? (v).n = (i) + 1 \
: 0), (v).a[(i)])
#endif