Code

plugin: Store real plugin name and filename in the context.
authorSebastian Harl <sh@tokkee.org>
Wed, 25 Sep 2013 19:43:32 +0000 (21:43 +0200)
committerSebastian Harl <sh@tokkee.org>
Wed, 25 Sep 2013 19:43:32 +0000 (21:43 +0200)
src/core/plugin.c

index efbbcf78b7fb87d29250ef73c305a77e4e711dd0..8250dde1e7c1825cd4e676b2ac7f6239bff4e824 100644 (file)
  */
 
 struct sdb_plugin_info {
+       char *plugin_name;
+       char *filename;
+
+       /* public attributes */
        char *name;
 
        char *description;
@@ -60,7 +64,9 @@ struct sdb_plugin_info {
        int   version;
        int   plugin_version;
 };
-#define SDB_PLUGIN_INFO_INIT { /* name */ NULL, /* desc */ NULL, \
+#define SDB_PLUGIN_INFO_INIT { \
+       /* plugin_name */ NULL, /* filename */ NULL, \
+       /* name */ NULL, /* desc */ NULL, \
        /* copyright */ NULL, /* license */ NULL, \
        /* version */ -1, /* plugin_version */ -1 }
 #define INFO_GET(i, attr) \
@@ -127,6 +133,11 @@ sdb_plugin_info_clear(sdb_plugin_info_t *info)
        if (! info)
                return;
 
+       if (info->plugin_name)
+               free(info->plugin_name);
+       if (info->filename)
+               free(info->filename);
+
        if (info->name)
                free(info->name);
        if (info->description)
@@ -377,6 +388,9 @@ sdb_plugin_load(const char *name, const sdb_plugin_ctx_t *plugin_ctx)
                return -1;
        }
 
+       ctx->info.plugin_name = strdup(name);
+       ctx->info.filename = strdup(filename);
+
        if (plugin_ctx)
                ctx->public = *plugin_ctx;