[master] 989c6d2 Add INIT_OBJ() macro which zeros and sets magic

Poul-Henning Kamp phk at FreeBSD.org
Wed Oct 22 09:37:48 CEST 2014


commit 989c6d2fbea54186b6ee09091137ed1a543de810
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Oct 22 07:37:23 2014 +0000

    Add INIT_OBJ() macro which zeros and sets magic

diff --git a/include/miniobj.h b/include/miniobj.h
index e1db10d..746f606 100644
--- a/include/miniobj.h
+++ b/include/miniobj.h
@@ -5,6 +5,12 @@
  *
  */
 
+#define INIT_OBJ(to, type_magic)					\
+	do {								\
+		(void)memset(to, 0, sizeof *to);			\
+		(to)->magic = (type_magic);				\
+	} while (0)
+
 #define ALLOC_OBJ(to, type_magic)					\
 	do {								\
 		(to) = calloc(sizeof *(to), 1);				\



More information about the varnish-commit mailing list