]> mj.ucw.cz Git - libucw.git/commitdiff
gary.h: Fixed bug in INIT_SPACE_* macros
authorTomas Valla <tom@ucw.cz>
Mon, 22 Jul 2013 09:08:43 +0000 (11:08 +0200)
committerTomas Valla <tom@ucw.cz>
Mon, 22 Jul 2013 09:08:43 +0000 (11:08 +0200)
commit 629bd47e7b61b251d055dccfecf124bacad17f76 from MD2

ucw/gary.h

index 5630bc2fb5645a5ee6615f43eb531b0eaa5aed65..8fa729290ed9d58675d40af0e8a3eb07b6ca834b 100644 (file)
@@ -20,8 +20,8 @@ struct gary_hdr {
 
 #define GARY_INIT(ptr, n) (ptr) = gary_init(sizeof(*(ptr)), (n), 0)
 #define GARY_INIT_ZERO(ptr, n) (ptr) = gary_init(sizeof(*(ptr)), (n), 1)
 
 #define GARY_INIT(ptr, n) (ptr) = gary_init(sizeof(*(ptr)), (n), 0)
 #define GARY_INIT_ZERO(ptr, n) (ptr) = gary_init(sizeof(*(ptr)), (n), 1)
-#define GARY_INIT_SPACE(ptr, n) do { GARY_INIT(ptr, n); (ptr)->num_elts = 0; } while (0)
-#define GARY_INIT_SPACE_ZERO(ptr, n) do { GARY_INIT_ZERO(ptr, n); (ptr)->num_elts = 0; } while (0)
+#define GARY_INIT_SPACE(ptr, n) do { GARY_INIT(ptr, n); (GARY_HDR(ptr))->num_elts = 0; } while (0)
+#define GARY_INIT_SPACE_ZERO(ptr, n) do { GARY_INIT_ZERO(ptr, n); (GARY_HDR(ptr))->num_elts = 0; } while (0)
 #define GARY_FREE(ptr) do { if (ptr) xfree(GARY_HDR(ptr)); } while (0)
 #define GARY_SIZE(ptr) (GARY_HDR(ptr)->num_elts)
 #define GARY_RESIZE(ptr, n) ((ptr) = gary_set_size((ptr), (n)))
 #define GARY_FREE(ptr) do { if (ptr) xfree(GARY_HDR(ptr)); } while (0)
 #define GARY_SIZE(ptr) (GARY_HDR(ptr)->num_elts)
 #define GARY_RESIZE(ptr, n) ((ptr) = gary_set_size((ptr), (n)))