From: Sebastian Harl Date: Sun, 1 Feb 2009 16:36:25 +0000 (+0100) Subject: utils_complain: Added macro c_would_release(). X-Git-Tag: collectd-4.6.0~84 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=cb8ffccbb84105388df859d70165640f189fb205 utils_complain: Added macro c_would_release(). This macro returns true if the specified complaint would be released, false else. This is useful e.g. to do further actions when releasing a complaint. --- diff --git a/src/utils_complain.h b/src/utils_complain.h index b51a81c6..09c43750 100644 --- a/src/utils_complain.h +++ b/src/utils_complain.h @@ -76,6 +76,15 @@ void c_complain_once (int level, c_complain_t *c, const char *format, ...); /* * NAME + * c_would_release + * + * DESCRIPTION + * Returns true if the specified complaint would be released, false else. + */ +#define c_would_release(c) ((c)->interval != 0) + +/* + * NAME * c_release * * DESCRIPTION @@ -87,7 +96,7 @@ void c_complain_once (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) \ + if (c_would_release (c)) \ c_do_release(level, c, __VA_ARGS__); \ } while (0)