summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3113439)
raw | patch | inline | side by side (parent: 3113439)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 25 Sep 2013 19:49:42 +0000 (21:49 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 25 Sep 2013 19:49:42 +0000 (21:49 +0200) |
src/core/plugin.c | patch | blob | history |
diff --git a/src/core/plugin.c b/src/core/plugin.c
index 8250dde1e7c1825cd4e676b2ac7f6239bff4e824..ca79284fe60a41b5d17b3f129db277755587e9f7 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
*/
static void
-sdb_plugin_info_clear(sdb_plugin_info_t *info)
+plugin_info_clear(sdb_plugin_info_t *info)
{
sdb_plugin_info_t empty_info = SDB_PLUGIN_INFO_INIT;
if (! info)
free(info->license);
*info = empty_info;
-} /* sdb_plugin_info_clear */
+} /* plugin_info_clear */
static void
ctx_key_init(void)
} /* ctx_key_init */
static int
-sdb_plugin_cmp_next_update(const sdb_object_t *a, const sdb_object_t *b)
+plugin_cmp_next_update(const sdb_object_t *a, const sdb_object_t *b)
{
const sdb_plugin_collector_cb_t *ccb1
= (const sdb_plugin_collector_cb_t *)a;
return (ccb1->ccb_next_update > ccb2->ccb_next_update)
? 1 : (ccb1->ccb_next_update < ccb2->ccb_next_update)
? -1 : 0;
-} /* sdb_plugin_cmp_next_update */
+} /* plugin_cmp_next_update */
/*
* private types
ctx_destroy(sdb_object_t *obj)
{
ctx_t *ctx = CTX(obj);
- sdb_plugin_info_clear(&ctx->info);
+ plugin_info_clear(&ctx->info);
} /* ctx_destroy */
static sdb_type_t ctx_type = {
} /* ctx_set */
static int
-sdb_plugin_cb_init(sdb_object_t *obj, va_list ap)
+plugin_cb_init(sdb_object_t *obj, va_list ap)
{
sdb_llist_t **list = va_arg(ap, sdb_llist_t **);
const char *type = va_arg(ap, const char *);
sdb_object_ref(ud);
SDB_PLUGIN_CB(obj)->cb_user_data = ud;
return 0;
-} /* sdb_plugin_cb_init */
+} /* plugin_cb_init */
static void
-sdb_plugin_cb_destroy(sdb_object_t *obj)
+plugin_cb_destroy(sdb_object_t *obj)
{
assert(obj);
sdb_object_deref(SDB_PLUGIN_CB(obj)->cb_user_data);
sdb_object_deref(SDB_OBJ(SDB_PLUGIN_CB(obj)->cb_ctx));
-} /* sdb_plugin_cb_destroy */
+} /* plugin_cb_destroy */
static sdb_type_t sdb_plugin_cb_type = {
sizeof(sdb_plugin_cb_t),
- sdb_plugin_cb_init,
- sdb_plugin_cb_destroy
+ plugin_cb_init,
+ plugin_cb_destroy
};
static sdb_type_t sdb_plugin_collector_cb_type = {
sizeof(sdb_plugin_collector_cb_t),
- sdb_plugin_cb_init,
- sdb_plugin_cb_destroy
+ plugin_cb_init,
+ plugin_cb_destroy
};
static int
-sdb_plugin_add_callback(sdb_llist_t **list, const char *type,
+plugin_add_callback(sdb_llist_t **list, const char *type,
const char *name, void *callback, sdb_object_t *user_data)
{
sdb_object_t *obj;
sdb_log(SDB_LOG_INFO, "plugin: Registered %s callback '%s'.",
type, name);
return 0;
-} /* sdb_plugin_add_callback */
+} /* plugin_add_callback */
/*
* public API
int
sdb_plugin_register_config(const char *name, sdb_plugin_config_cb callback)
{
- return sdb_plugin_add_callback(&config_list, "init", name,
+ return plugin_add_callback(&config_list, "init", name,
callback, NULL);
} /* sdb_plugin_register_config */
sdb_plugin_register_init(const char *name, sdb_plugin_init_cb callback,
sdb_object_t *user_data)
{
- return sdb_plugin_add_callback(&init_list, "init", name,
+ return plugin_add_callback(&init_list, "init", name,
callback, user_data);
} /* sdb_plugin_register_init */
sdb_plugin_register_shutdown(const char *name, sdb_plugin_shutdown_cb callback,
sdb_object_t *user_data)
{
- return sdb_plugin_add_callback(&shutdown_list, "shutdown", name,
+ return plugin_add_callback(&shutdown_list, "shutdown", name,
callback, user_data);
} /* sdb_plugin_register_shutdown */
sdb_plugin_register_log(const char *name, sdb_plugin_log_cb callback,
sdb_object_t *user_data)
{
- return sdb_plugin_add_callback(&log_list, "log", name, callback,
+ return plugin_add_callback(&log_list, "log", name, callback,
user_data);
} /* sdb_plugin_register_log */
sdb_plugin_register_cname(const char *name, sdb_plugin_cname_cb callback,
sdb_object_t *user_data)
{
- return sdb_plugin_add_callback(&cname_list, "cname", name, callback,
+ return plugin_add_callback(&cname_list, "cname", name, callback,
user_data);
} /* sdb_plugin_register_cname */
@@ -581,7 +581,7 @@ sdb_plugin_register_collector(const char *name, sdb_plugin_collector_cb callback
}
if (sdb_llist_insert_sorted(collector_list, obj,
- sdb_plugin_cmp_next_update)) {
+ plugin_cmp_next_update)) {
sdb_object_deref(obj);
return -1;
}
}
if (sdb_llist_insert_sorted(collector_list, obj,
- sdb_plugin_cmp_next_update)) {
+ plugin_cmp_next_update)) {
sdb_log(SDB_LOG_ERR, "plugin: Failed to re-insert "
"plugin '%s' into collector list. Unable to further "
"use the plugin.",