Permalink
Browse files

Two bugs reported by istreeter and wanghc78

1 parent 15ddda3 commit 7aa0927bb0da67bd2317bb7dc7fe7c462598a2d5 @lh3 lh3 committed Jan 26, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 kvec.h
View
6 kvec.h
@@ -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

0 comments on commit 7aa0927

Please sign in to comment.