X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Futils_complain.h;h=b51a81c677a10d8777ca2d22b2ff7503093e0704;hb=db4f7362efcfd89447c950c945f789a44d6e55a5;hp=56e74eabac3400d729df19d80ed7636157ede56b;hpb=d1247a271c1822a0cc655473430b724ab10bc004;p=collectd.git diff --git a/src/utils_complain.h b/src/utils_complain.h index 56e74eab..b51a81c6 100644 --- a/src/utils_complain.h +++ b/src/utils_complain.h @@ -39,7 +39,8 @@ typedef struct int interval; } c_complain_t; -#define C_COMPLAIN_INIT { 0, 0 } +#define C_COMPLAIN_INIT_STATIC { 0, 0 } +#define C_COMPLAIN_INIT(c) do { (c)->last = 0; (c)->interval = 0; } while (0) /* * NAME @@ -83,7 +84,12 @@ void c_complain_once (int level, c_complain_t *c, const char *format, ...); * * See `c_complain' for a description of the parameters. */ -void c_release (int level, c_complain_t *c, const char *format, ...); +void c_do_release (int level, c_complain_t *c, const char *format, ...); +#define c_release(level, c, ...) \ + do { \ + if ((c)->interval != 0) \ + c_do_release(level, c, __VA_ARGS__); \ + } while (0) #endif /* UTILS_COMPLAIN_H */