From: phk Date: Sun, 23 Sep 2007 12:44:12 +0000 (+0000) Subject: Add CHECK_OBJ_ORNULL() macro X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8473abef0dac8b382835558bd9516a19dfeb6510;p=varnish Add CHECK_OBJ_ORNULL() macro git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1981 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/include/miniobj.h b/varnish-cache/include/miniobj.h index cb727c58..a620f8f9 100644 --- a/varnish-cache/include/miniobj.h +++ b/varnish-cache/include/miniobj.h @@ -23,6 +23,12 @@ assert((ptr)->magic == type_magic); \ } while (0) +#define CHECK_OBJ_ORNULL(ptr, type_magic) \ + do { \ + if ((ptr) != NULL) \ + assert((ptr)->magic == type_magic); \ + } while (0) + #define CAST_OBJ(to, from, type_magic) \ do { \ (to) = (from); \