From: Sebastian Harl Date: Sat, 28 Jun 2014 07:27:30 +0000 (+0200) Subject: plugin: The replaced SDB_PLUGIN_INFO_NAME with the actual plugin name. X-Git-Tag: sysdb-0.2.0~22 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=0d6312e285f39dd133eaab049e96cb073f754566;ds=sidebyside plugin: The replaced SDB_PLUGIN_INFO_NAME with the actual plugin name. There's no need for any duplication. --- diff --git a/src/backend/collectd/unixsock.c b/src/backend/collectd/unixsock.c index 21e1f8b..00e1258 100644 --- a/src/backend/collectd/unixsock.c +++ b/src/backend/collectd/unixsock.c @@ -366,7 +366,6 @@ sdb_collectd_config(oconfig_item_t *ci) int sdb_module_init(sdb_plugin_info_t *info) { - sdb_plugin_set_info(info, SDB_PLUGIN_INFO_NAME, "collectd::unixsock"); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_DESC, "backend accessing the system statistics collection daemon " "throught the UNIXSOCK interface"); diff --git a/src/backend/mk-livestatus.c b/src/backend/mk-livestatus.c index eb544b8..6481807 100644 --- a/src/backend/mk-livestatus.c +++ b/src/backend/mk-livestatus.c @@ -317,7 +317,6 @@ sdb_livestatus_config(oconfig_item_t *ci) int sdb_module_init(sdb_plugin_info_t *info) { - sdb_plugin_set_info(info, SDB_PLUGIN_INFO_NAME, "MK-Livestatus"); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_DESC, "backend accessing Nagios/Icinga/Shinken using MK Livestatus"); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_COPYRIGHT, diff --git a/src/backend/puppet/store-configs.c b/src/backend/puppet/store-configs.c index 23d261b..ebe5dbd 100644 --- a/src/backend/puppet/store-configs.c +++ b/src/backend/puppet/store-configs.c @@ -368,7 +368,6 @@ sdb_puppet_stcfg_config(oconfig_item_t *ci) int sdb_module_init(sdb_plugin_info_t *info) { - sdb_plugin_set_info(info, SDB_PLUGIN_INFO_NAME, "puppet::store-configs"); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_DESC, "backend accessing the Puppet stored configuration database"); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_COPYRIGHT, diff --git a/src/core/plugin.c b/src/core/plugin.c index 32966de..0e87ce5 100644 --- a/src/core/plugin.c +++ b/src/core/plugin.c @@ -59,8 +59,6 @@ struct sdb_plugin_info { char *filename; /* public attributes */ - char *name; - char *description; char *copyright; char *license; @@ -69,8 +67,7 @@ struct sdb_plugin_info { int plugin_version; }; #define SDB_PLUGIN_INFO_INIT { \ - /* plugin_name */ NULL, /* filename */ NULL, \ - /* name */ NULL, /* desc */ NULL, \ + /* plugin_name */ NULL, /* filename */ NULL, /* desc */ NULL, \ /* copyright */ NULL, /* license */ NULL, \ /* version */ -1, /* plugin_version */ -1 } #define INFO_GET(i, attr) \ @@ -165,8 +162,6 @@ plugin_info_clear(sdb_plugin_info_t *info) if (info->filename) free(info->filename); - if (info->name) - free(info->name); if (info->description) free(info->description); if (info->copyright) @@ -526,7 +521,7 @@ module_load(const char *basedir, const char *name, sdb_log(SDB_LOG_INFO, "core: Successfully loaded " "plugin '%s' v%i (%s)\n\t%s\n\tLicense: %s", - INFO_GET(&ctx->info, name), ctx->info.plugin_version, + ctx->info.plugin_name, ctx->info.plugin_version, INFO_GET(&ctx->info, description), INFO_GET(&ctx->info, copyright), INFO_GET(&ctx->info, license)); @@ -620,7 +615,7 @@ sdb_plugin_load(const char *basedir, const char *name, return status; sdb_log(SDB_LOG_INFO, "core: Successfully reloaded plugin " - "'%s' (%s)", INFO_GET(&ctx->info, name), + "'%s' (%s)", ctx->info.plugin_name, INFO_GET(&ctx->info, description)); ctx_set(old_ctx); } @@ -642,16 +637,6 @@ sdb_plugin_set_info(sdb_plugin_info_t *info, int type, ...) va_start(ap, type); switch (type) { - case SDB_PLUGIN_INFO_NAME: - { - char *name = va_arg(ap, char *); - if (name) { - if (info->name) - free(info->name); - info->name = strdup(name); - } - } - break; case SDB_PLUGIN_INFO_DESC: { char *desc = va_arg(ap, char *); diff --git a/src/include/core/plugin.h b/src/include/core/plugin.h index bcf01ec..3d93880 100644 --- a/src/include/core/plugin.h +++ b/src/include/core/plugin.h @@ -78,7 +78,6 @@ sdb_plugin_load(const char *basedir, const char *name, * and also to provide additional information to the user. */ enum { - SDB_PLUGIN_INFO_NAME, /* plugin name: string */ SDB_PLUGIN_INFO_DESC, /* plugin description: string */ SDB_PLUGIN_INFO_COPYRIGHT, /* plugin copyright: string */ SDB_PLUGIN_INFO_LICENSE, /* plugin license: string */ diff --git a/src/plugins/cname/dns.c b/src/plugins/cname/dns.c index b35ebf1..e54ce7c 100644 --- a/src/plugins/cname/dns.c +++ b/src/plugins/cname/dns.c @@ -84,7 +84,6 @@ sdb_dns_cname(const char *name, int sdb_module_init(sdb_plugin_info_t *info) { - sdb_plugin_set_info(info, SDB_PLUGIN_INFO_NAME, "cname::dns"); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_DESC, "canonicalize hostnames by querying DNS"); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_COPYRIGHT, diff --git a/src/plugins/syslog.c b/src/plugins/syslog.c index f9a285e..02c6241 100644 --- a/src/plugins/syslog.c +++ b/src/plugins/syslog.c @@ -80,7 +80,6 @@ sdb_syslog_shutdown(sdb_object_t __attribute__((unused)) *user_data) int sdb_module_init(sdb_plugin_info_t *info) { - sdb_plugin_set_info(info, SDB_PLUGIN_INFO_NAME, "syslog"); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_DESC, "log messages to the system logger"); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_COPYRIGHT, diff --git a/t/integration/mock_plugin.c b/t/integration/mock_plugin.c index 2573e64..8dcb410 100644 --- a/t/integration/mock_plugin.c +++ b/t/integration/mock_plugin.c @@ -195,7 +195,6 @@ mock_config(oconfig_item_t *ci) int sdb_module_init(sdb_plugin_info_t *info) { - sdb_plugin_set_info(info, SDB_PLUGIN_INFO_NAME, "test::integration::mock"); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_DESC, "a mock plugin"); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_COPYRIGHT, "Copyright (C) 2012 Sebastian 'tokkee' Harl ");