Browse Source

Change type for builtin plugin list

Serj Kalichev 10 years ago
parent
commit
94c132116d
4 changed files with 9 additions and 6 deletions
  1. 6 1
      clish/plugin.h
  2. 1 3
      clish/plugin/plugin.c
  3. 1 1
      clish/plugin_builtin.c.in
  4. 1 1
      configure.ac

+ 6 - 1
clish/plugin.h

@@ -51,7 +51,12 @@ typedef CLISH_HOOK_LOG(clish_hook_log_fn_t);
 #define SYM_FN(TYPE,SYM) (*((clish_hook_##TYPE##_fn_t *)(clish_sym__get_func(SYM))))
 
 /* Create an array of builtin plugin's init functions */
-extern clish_plugin_init_t * clish_plugin_builtin_list[];
+struct clish_plugin_builtin_list_s {
+	const char *name; /* Plugin name */
+	clish_plugin_init_t *init; /* Plugin init function */
+};
+typedef struct clish_plugin_builtin_list_s clish_plugin_builtin_list_t;
+extern clish_plugin_builtin_list_t * clish_plugin_builtin_list[];
 
 /* Symbol */
 

+ 1 - 3
clish/plugin/plugin.c

@@ -320,8 +320,6 @@ static int clish_plugin_load_builtin(clish_plugin_t *this)
 int clish_plugin_load(clish_plugin_t *this, void *userdata)
 {
 	int res;
-	char *file = NULL; /* Plugin so file name */
-	char *init_name = NULL; /* Init function name */
 
 	if (!this)
 		return -1;
@@ -331,7 +329,7 @@ int clish_plugin_load(clish_plugin_t *this, void *userdata)
 	   no such builtin plugin then try to find plugin 
 	   shared object */
 	if (clish_plugin_load_builtin(this) < 0) {
-		if (clish_load_plugin_shared(this) < 0)
+		if (clish_plugin_load_shared(this) < 0)
 			return -1;
 	}
 

+ 1 - 1
clish/plugin_builtin.c.in

@@ -10,5 +10,5 @@
 #include "clish/plugin.h"
 
 /* The array of builtin plugin's filled by configure script. */
-clish_plugin_init_t * clish_plugin_builtin_list[] = {@CLISH_PLUGIN_BUILTIN_LIST@ NULL};
+clish_plugin_builtin_list_t *clish_plugin_builtin_list[] = {@CLISH_PLUGIN_BUILTIN_LIST@ NULL};
 

+ 1 - 1
configure.ac

@@ -541,7 +541,7 @@ AC_CHECK_HEADERS(dlfcn.h, [
         ])
     ],[
           AC_MSG_WARN([dlfcn.h not found: the dl operations is not supported])
-          CLISH_PLUGIN_BUILTIN_LIST="$CLISH_PLUGIN_BUILTIN_LIST clish_clish_plugin_init,"
+          CLISH_PLUGIN_BUILTIN_LIST="$CLISH_PLUGIN_BUILTIN_LIST { "clish", clish_clish_plugin_init },"
     ])
 AC_SUBST([CLISH_PLUGIN_BUILTIN_LIST])
 AC_CONFIG_FILES([clish/plugin_builtin.c])