From: Sebastian Harl Date: Wed, 25 Sep 2013 19:43:32 +0000 (+0200) Subject: plugin: Store real plugin name and filename in the context. X-Git-Tag: sysdb-0.1.0~343 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=311343983a332aca8bfb264b9e9337b102e9f95f;p=sysdb.git plugin: Store real plugin name and filename in the context. --- diff --git a/src/core/plugin.c b/src/core/plugin.c index efbbcf7..8250dde 100644 --- a/src/core/plugin.c +++ b/src/core/plugin.c @@ -51,6 +51,10 @@ */ 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;