]> err.no Git - varnish/commitdiff
Add ALLOC_OBJ macro
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 15 Feb 2008 10:28:00 +0000 (10:28 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 15 Feb 2008 10:28:00 +0000 (10:28 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2470 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/include/miniobj.h

index 2565f10225257795ac983d1e2a360ddf7607e23f..fc99f4453beab96d7fc83b951d5547d3b4003ca6 100644 (file)
@@ -6,6 +6,13 @@
  * $Id$
  */
 
+#define ALLOC_OBJ(to, type_magic)                                      \
+       do {                                                            \
+               (to) = calloc(sizeof *(to), 1);                         \
+               if ((to) != NULL)                                       \
+                       (to)->magic = (type_magic);                     \
+       } while (0)
+
 #define FREE_OBJ(to)                                                   \
        do {                                                            \
                (to)->magic = (0);                                      \