Merge branch 'collectd-5.8'
[collectd.git] / src / daemon / utils_complain.h
index 390f961..88387be 100644 (file)
 
 #include "utils_time.h"
 
-typedef struct
-{
-       /* time of the last report */
-       cdtime_t last;
+typedef struct {
+  /* time of the last report */
+  cdtime_t last;
 
-       /* How long to wait until reporting again.
-        * 0 indicates that the complaint is no longer valid. */
-       cdtime_t interval;
+  /* How long to wait until reporting again.
+   * 0 indicates that the complaint is no longer valid. */
+  cdtime_t interval;
 
-       _Bool complained_once;
+  bool complained_once;
 } c_complain_t;
 
-#define C_COMPLAIN_INIT_STATIC { 0, 0, 0 }
-#define C_COMPLAIN_INIT(c) do { \
-       (c)->last = 0; \
-       (c)->interval = 0; \
-       (c)->complained_once = 0; \
-} while (0)
+#define C_COMPLAIN_INIT_STATIC                                                 \
+  { 0, 0, 0 }
+#define C_COMPLAIN_INIT(c)                                                     \
+  do {                                                                         \
+    (c)->last = 0;                                                             \
+    (c)->interval = 0;                                                         \
+    (c)->complained_once = false;                                              \
+  } while (0)
 
 /*
  * NAME
@@ -66,7 +67,8 @@ typedef struct
  *   `c'      Identifier for the complaint.
  *   `format' Message format - see the documentation of printf(3).
  */
-void c_complain (int level, c_complain_t *c, const char *format, ...);
+__attribute__((format(printf, 3, 4))) void
+c_complain(int level, c_complain_t *c, const char *format, ...);
 
 /*
  * NAME
@@ -80,7 +82,8 @@ void c_complain (int level, c_complain_t *c, const char *format, ...);
  *
  *   See `c_complain' for further details and a description of the parameters.
  */
-void c_complain_once (int level, c_complain_t *c, const char *format, ...);
+__attribute__((format(printf, 3, 4))) void
+c_complain_once(int level, c_complain_t *c, const char *format, ...);
 
 /*
  * NAME
@@ -101,14 +104,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_do_release (int level, c_complain_t *c, const char *format, ...);
-#define c_release(level, c, ...) \
-       do { \
-               if (c_would_release (c)) \
-                       c_do_release(level, c, __VA_ARGS__); \
-       } while (0)
+__attribute__((format(printf, 3, 4))) void
+c_do_release(int level, c_complain_t *c, const char *format, ...);
+#define c_release(level, c, ...)                                               \
+  do {                                                                         \
+    if (c_would_release(c))                                                    \
+      c_do_release(level, c, __VA_ARGS__);                                     \
+  } while (0)
 
 #endif /* UTILS_COMPLAIN_H */
-
-/* vim: set sw=4 ts=4 tw=78 noexpandtab : */
-