From: phk Date: Fri, 15 Feb 2008 10:28:00 +0000 (+0000) Subject: Add ALLOC_OBJ macro X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c979f4d4629240f44d987a7601fa49504812244a;p=varnish Add ALLOC_OBJ macro git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2470 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/include/miniobj.h b/varnish-cache/include/miniobj.h index 2565f102..fc99f445 100644 --- a/varnish-cache/include/miniobj.h +++ b/varnish-cache/include/miniobj.h @@ -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); \