bind plugin: Eliminate the `goto' in `bind_xml'.
[collectd.git] / src / common.h
index a5e2167..aefc2cc 100644 (file)
 #endif
 
 #define sfree(ptr) \
-       if((ptr) != NULL) { \
-               free(ptr); \
-       } \
-       (ptr) = NULL
+       do { \
+               if((ptr) != NULL) { \
+                       free(ptr); \
+               } \
+               (ptr) = NULL; \
+       } while (0)
 
 #define STATIC_ARRAY_SIZE(a) (sizeof (a) / sizeof (*(a)))
 
@@ -201,8 +203,12 @@ int notification_init (notification_t *n, int severity, const char *message,
                        (vl)->host, (vl)->plugin, (vl)->plugin_instance, \
                        (ds)->type, (vl)->type_instance)
 
-typedef int (*dirwalk_callback_f)(const char *filename);
-int walk_directory (const char *dir, dirwalk_callback_f callback);
+typedef int (*dirwalk_callback_f)(const char *dirname, const char *filename,
+               void *user_data);
+int walk_directory (const char *dir, dirwalk_callback_f callback,
+               void *user_data);
 int read_file_contents (const char *filename, char *buf, int bufsize);
 
+counter_t counter_diff (counter_t old_value, counter_t new_value);
+
 #endif /* COMMON_H */