Fixed various signedness issues identified by -Wextra.
[collectd.git] / src / plugin.c
index cd7b108..61cc09c 100644 (file)
@@ -56,7 +56,6 @@ typedef struct read_func_s read_func_t;
 static llist_t *list_init;
 static llist_t *list_read;
 static llist_t *list_write;
-static llist_t *list_filter;
 static llist_t *list_flush;
 static llist_t *list_shutdown;
 static llist_t *list_log;
@@ -172,7 +171,7 @@ static int plugin_load_file (char *file)
        return (0);
 }
 
-static void *plugin_read_thread (void *args)
+static void *plugin_read_thread (void __attribute__((unused)) *args)
 {
        llentry_t   *le;
        read_func_t *rf;
@@ -329,6 +328,7 @@ int plugin_load (const char *type)
        int   ret;
        struct stat    statbuf;
        struct dirent *de;
+       int status;
 
        DEBUG ("type = %s", type);
 
@@ -337,8 +337,8 @@ int plugin_load (const char *type)
 
        /* `cpu' should not match `cpufreq'. To solve this we add `.so' to the
         * type when matching the filename */
-       if (ssnprintf (typename, sizeof (typename),
-                       "%s.so", type) >= sizeof (typename))
+       status = ssnprintf (typename, sizeof (typename), "%s.so", type);
+       if ((status < 0) || ((size_t) status >= sizeof (typename)))
        {
                WARNING ("snprintf: truncated: `%s.so'", type);
                return (-1);
@@ -358,8 +358,9 @@ int plugin_load (const char *type)
                if (strncasecmp (de->d_name, typename, typename_len))
                        continue;
 
-               if (ssnprintf (filename, sizeof (filename),
-                               "%s/%s", dir, de->d_name) >= sizeof (filename))
+               status = ssnprintf (filename, sizeof (filename),
+                               "%s/%s", dir, de->d_name);
+               if ((status < 0) || ((size_t) status >= sizeof (filename)))
                {
                        WARNING ("snprintf: truncated: `%s/%s'", dir, de->d_name);
                        continue;
@@ -450,12 +451,6 @@ int plugin_register_write (const char *name,
        return (register_callback (&list_write, name, (void *) callback));
 } /* int plugin_register_write */
 
-int plugin_register_filter (const char *name,
-               int (*callback) (const data_set_t *ds, value_list_t *vl))
-{
-       return (register_callback (&list_filter, name, (void *) callback));
-} /* int plugin_register_filter */
-
 int plugin_register_flush (const char *name,
                int (*callback) (const int timeout, const char *identifier))
 {
@@ -556,11 +551,6 @@ int plugin_unregister_write (const char *name)
        return (plugin_unregister (list_write, name));
 }
 
-int plugin_unregister_filter (const char *name)
-{
-       return (plugin_unregister (list_filter, name));
-}
-
 int plugin_unregister_flush (const char *name)
 {
        return (plugin_unregister (list_flush, name));