Code

plugin: Make sdb_plugin_info_t public.
[sysdb.git] / src / core / plugin.c
index 32966deabcf8042dbf58e120016419833a05dde0..f10a904169f5d3993dc89894535e6a7b4ca01513 100644 (file)
 
 #include <pthread.h>
 
+/* helper to access info attributes */
+#define INFO_GET(i, attr) \
+       ((i)->attr ? (i)->attr : #attr" not set")
+
 /*
  * private data types
  */
 
-struct sdb_plugin_info {
-       char *plugin_name;
-       char *filename;
-
-       /* public attributes */
-       char *name;
-
-       char *description;
-       char *copyright;
-       char *license;
-
-       int   version;
-       int   plugin_version;
-};
-#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) \
-       ((i)->attr ? (i)->attr : #attr" not set")
-
 typedef struct {
        sdb_object_t super;
        sdb_plugin_ctx_t public;
@@ -165,8 +147,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)
@@ -525,9 +505,11 @@ module_load(const char *basedir, const char *name,
        sdb_llist_append(all_plugins, SDB_OBJ(ctx));
 
        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,
-                       INFO_GET(&ctx->info, description),
+                       "plugin %s v%i (%s)", ctx->info.plugin_name,
+                       ctx->info.plugin_version,
+                       INFO_GET(&ctx->info, description));
+       sdb_log(SDB_LOG_INFO, "core: Plugin %s: %s, License: %s",
+                       ctx->info.plugin_name,
                        INFO_GET(&ctx->info, copyright),
                        INFO_GET(&ctx->info, license));
 
@@ -620,7 +602,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 +624,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 *);