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 21e1f8b2bda204183b3414b2668fafedda8b0eb4..00e1258eb222761d052a556824deac68fb690997 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 eb544b8b24bcd4e00717eaa7dea7b47eb6c7fc99..6481807637fb9bfba7ffeb5d584a19b083cf7410 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 23d261bacf46baf7b3939f5718fe529c714f98d7..ebe5dbd6468821d929a43d31d5e53178069063af 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 32966deabcf8042dbf58e120016419833a05dde0..0e87ce5a9f51f5a719031e36b0dc83460729bb83 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 bcf01ec411bd5d2dc7e3ab25d17a99f88edd7037..3d938807f61d2c1098dae31429157946b908b2f8 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 b35ebf1666e662984d1aea372f3fd802ef259c05..e54ce7cd739de3face3c94ef2023a412146142e4 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 f9a285e98cd484bff8c36022a9fd427442567639..02c62414b6856cd7003c1fd677f312007826b1ce 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 2573e64765543ee4c6cc2802250083d8ed362eec..8dcb410af3492a0da588c6ba56f5cc7c3b5ddfaf 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>");