From c979f4d4629240f44d987a7601fa49504812244a Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 15 Feb 2008 10:28:00 +0000 Subject: [PATCH] Add ALLOC_OBJ macro git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2470 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/include/miniobj.h | 7 +++++++ 1 file changed, 7 insertions(+) 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); \ -- 2.39.5