Merge branch 'collectd-4.0'
[collectd.git] / src / plugin.c
index 8087950..248e583 100644 (file)
@@ -133,7 +133,6 @@ static int plugin_load_file (char *file)
                const char *error = lt_dlerror ();
 
                ERROR ("lt_dlopen failed: %s", error);
-               DEBUG ("lt_dlopen failed: %s", error);
                return (1);
        }
 
@@ -194,7 +193,7 @@ static void *plugin_read_thread (void *args)
                                        rf->wait_time = 86400;
 
                                NOTICE ("read-function of plugin `%s' "
-                                               "failed. Will syspend it for %i "
+                                               "failed. Will suspend it for %i "
                                                "seconds.", le->key, rf->wait_left);
                        }
                        else
@@ -374,6 +373,12 @@ int plugin_register_config (const char *name,
        return (0);
 } /* int plugin_register_config */
 
+int plugin_register_complex_config (const char *type,
+               int (*callback) (oconfig_item_t *))
+{
+       return (cf_register_complex (type, callback));
+} /* int plugin_register_complex_config */
+
 int plugin_register_init (const char *name,
                int (*callback) (void))
 {
@@ -458,6 +463,12 @@ int plugin_unregister_config (const char *name)
        return (0);
 } /* int plugin_unregister_config */
 
+int plugin_unregister_complex_config (const char *name)
+{
+       cf_unregister_complex (name);
+       return (0);
+} /* int plugin_unregister_complex_config */
+
 int plugin_unregister_init (const char *name)
 {
        return (plugin_unregister (list_init, name));
@@ -607,6 +618,11 @@ void plugin_shutdown_all (void)
        while (le != NULL)
        {
                callback = (int (*) (void)) le->value;
+
+               /* Advance the pointer before calling the callback allows
+                * shutdown functions to unregister themselves. If done the
+                * other way around the memory `le' points to will be freed
+                * after callback returns. */
                le = le->next;
 
                (*callback) ();