From 311343983a332aca8bfb264b9e9337b102e9f95f Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 25 Sep 2013 21:43:32 +0200 Subject: [PATCH] plugin: Store real plugin name and filename in the context. --- src/core/plugin.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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; -- 2.30.2