X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fplugin.c;h=bed26f0feeb072b955665fe24d2c62ab9fab1b16;hb=60172edc441eb64206aa1942576128bc07369f5f;hp=36cd80af61e7a9c9976465e9fdedd8928e4895c8;hpb=aed9a008cc5d155fc08f69f3e1da1e3069deaf13;p=collectd.git diff --git a/src/plugin.c b/src/plugin.c index 36cd80af..bed26f0f 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -194,7 +194,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 +374,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 +464,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,9 +619,14 @@ void plugin_shutdown_all (void) while (le != NULL) { callback = (int (*) (void)) le->value; - (*callback) (); + /* 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) (); } } /* void plugin_shutdown_all */