Code

plugin: The replaced SDB_PLUGIN_INFO_NAME with the actual plugin name.
authorSebastian Harl <sh@tokkee.org>
Sat, 28 Jun 2014 07:27:30 +0000 (09:27 +0200)
committerSebastian Harl <sh@tokkee.org>
Sat, 28 Jun 2014 07:27:30 +0000 (09:27 +0200)
There's no need for any duplication.

src/backend/collectd/unixsock.c
src/backend/mk-livestatus.c
src/backend/puppet/store-configs.c
src/core/plugin.c
src/include/core/plugin.h
src/plugins/cname/dns.c
src/plugins/syslog.c
t/integration/mock_plugin.c

index 21e1f8b..00e1258 100644 (file)
@@ -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");
index eb544b8..6481807 100644 (file)
@@ -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,
index 23d261b..ebe5dbd 100644 (file)
@@ -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,
index 32966de..0e87ce5 100644 (file)
@@ -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 *);
index bcf01ec..3d93880 100644 (file)
@@ -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 */
index b35ebf1..e54ce7c 100644 (file)
@@ -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,
index f9a285e..02c6241 100644 (file)
@@ -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,
index 2573e64..8dcb410 100644 (file)
@@ -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 <sh@tokkee.org>");