From eba07b47cdf64a1009b77d899f1435cc501e9eaa Mon Sep 17 00:00:00 2001 From: comex Date: Fri, 7 Aug 2015 17:14:23 -0400 Subject: fix vec.h bug --- configure | 1 + lib/cbit/vec.h | 4 ++-- lib/jump-dis.c | 2 +- test/test-vec.cpp | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/configure b/configure index d0c2f9e..ff6ec33 100755 --- a/configure +++ b/configure @@ -171,6 +171,7 @@ if settings.enable_tests: ('posixspawn-hook',), ('htab',), ('vec', {'cpp': True, 'extra_objs': ['(out)/lib/cbit/vec.o']}), + ('vec-c', 'vec', ['-x', 'c'], {'extra_objs': ['(out)/lib/cbit/vec.o']}), ] for arch, hdr, xdis, target in [ diff --git a/lib/cbit/vec.h b/lib/cbit/vec.h index eddee6a..cbefc0c 100644 --- a/lib/cbit/vec.h +++ b/lib/cbit/vec.h @@ -37,12 +37,12 @@ void vec_realloc_internal_as_necessary(struct vec_internal *vi, }; \ }; \ UNUSED_STATIC_INLINE \ - void vec_free_storage(struct vec_##name *v) { \ + void vec_free_storage_##name(struct vec_##name *v) { \ if (v->els != v->storage) \ free(v->els); \ } \ UNUSED_STATIC_INLINE \ - struct vec_##name vec_borrow(VEC_TY(name) *els, size_t length) { \ + struct vec_##name vec_borrow##name(VEC_TY(name) *els, size_t length) { \ struct vec_##name v; \ v.length = v.capacity = length; \ v.els = els; \ diff --git a/lib/jump-dis.c b/lib/jump-dis.c index 9b8bd18..8c33cf4 100644 --- a/lib/jump-dis.c +++ b/lib/jump-dis.c @@ -171,7 +171,7 @@ done: /* no bad instructions! */ ret = false; fail: - vec_free_storage(&ctx.queue.v); + vec_free_storage_uint_tptr(&ctx.queue.v); return ret; } diff --git a/test/test-vec.cpp b/test/test-vec.cpp index f587c1b..9bb3daa 100644 --- a/test/test-vec.cpp +++ b/test/test-vec.cpp @@ -1,6 +1,7 @@ #include "cbit/vec.h" #include DECL_VEC(const char *, ccp); +DECL_VEC(int, int); int main() { VEC_STORAGE(ccp) stor; -- cgit v1.2.3