Browse Source

scheme.plugin: Remove alias attribute

Serj Kalichev 3 years ago
parent
commit
2b2ec905b1
5 changed files with 1 additions and 30 deletions
  1. 0 2
      bin/klishd/sch.c
  2. 0 3
      klish.xsd
  3. 0 4
      klish/kplugin.h
  4. 0 1
      klish/kscheme/iplugin.c
  5. 1 20
      klish/kscheme/kplugin.c

+ 0 - 2
bin/klishd/sch.c

@@ -4,14 +4,12 @@ ischeme_t sch = {
 
   PLUGIN {
    .name = "plugin1",
-   .alias = "alias1",
    .file = "file1",
    .global = "true",
   },
 
   PLUGIN {
    .name = "plugin2",
-   .alias = "alias2",
    .file = "file2",
    .global = "false",
   },

+ 0 - 3
klish.xsd

@@ -480,8 +480,6 @@
 *
 * name - Plugin name. If "file" attribute is not specified then plugin's
 *	filename is autogenerated as "klish-plugin-<name>.so".
-* [alias] - Plugin's alias that can be used instead original name in
-*	symbol references.
 * [file] - File name if standard autogenerated filename (using "name" field)
 *	is not appropriate.
 * [global] - A boolean RTLD_GLOBAL flag for dlopen()
@@ -492,7 +490,6 @@
 		<xs:simpleContent>
 			<xs:extension base="xs:string">
 				<xs:attribute name="name" type="xs:string" use="required"/>
-				<xs:attribute name="alias" type="xs:string" use="optional"/>
 				<xs:attribute name="file" type="xs:string" use="optional"/>
 				<xs:attribute name="global" type="xs:boolean" use="optional" default="false"/>
 			</xs:extension>

+ 0 - 4
klish/kplugin.h

@@ -12,7 +12,6 @@ typedef struct kplugin_s kplugin_t;
 
 typedef struct iplugin_s {
 	char *name;
-	char *alias;
 	char *file;
 	char *global;
 	char *script;
@@ -24,7 +23,6 @@ typedef enum {
 	KPLUGIN_ERROR_INTERNAL,
 	KPLUGIN_ERROR_ALLOC,
 	KPLUGIN_ERROR_ATTR_NAME,
-	KPLUGIN_ERROR_ATTR_ALIAS,
 	KPLUGIN_ERROR_ATTR_FILE,
 	KPLUGIN_ERROR_ATTR_GLOBAL,
 	KPLUGIN_ERROR_SCRIPT,
@@ -44,8 +42,6 @@ const char *kplugin_strerror(kplugin_error_e error);
 
 const char *kplugin_name(const kplugin_t *plugin);
 bool_t kplugin_set_name(kplugin_t *plugin, const char *name);
-const char *kplugin_alias(const kplugin_t *plugin);
-bool_t kplugin_set_alias(kplugin_t *plugin, const char *alias);
 const char *kplugin_file(const kplugin_t *plugin);
 bool_t kplugin_set_file(kplugin_t *plugin, const char *file);
 bool_t kplugin_global(const kplugin_t *plugin);

+ 0 - 1
klish/kscheme/iplugin.c

@@ -19,7 +19,6 @@ char *iplugin_to_text(const iplugin_t *iplugin, int level)
 	faux_str_free(tmp);
 
 	attr2ctext(&str, "name", iplugin->name, level + 1);
-	attr2ctext(&str, "alias", iplugin->alias, level + 1);
 	attr2ctext(&str, "file", iplugin->file, level + 1);
 	attr2ctext(&str, "global", iplugin->global, level + 1);
 

+ 1 - 20
klish/kscheme/kplugin.c

@@ -13,7 +13,6 @@
 
 struct kplugin_s {
 	char *name;
-	char *alias;
 	char *file;
 	bool_t global;
 	char *script;
@@ -26,11 +25,7 @@ struct kplugin_s {
 KGET_STR(plugin, name);
 KSET_STR_ONCE(plugin, name);
 
-// Alias
-KGET_STR(plugin, alias);
-KSET_STR(plugin, alias);
-
-// Alias
+// File
 KGET_STR(plugin, file);
 KSET_STR(plugin, file);
 
@@ -54,7 +49,6 @@ static kplugin_t *kplugin_new_empty(void)
 
 	// Initialize
 	plugin->name = NULL;
-	plugin->alias = NULL;
 	plugin->file = NULL;
 	plugin->global = BOOL_FALSE;
 	plugin->script = NULL;
@@ -93,7 +87,6 @@ void kplugin_free(kplugin_t *plugin)
 		return;
 
 	faux_str_free(plugin->name);
-	faux_str_free(plugin->alias);
 	faux_str_free(plugin->file);
 	faux_str_free(plugin->script);
 
@@ -118,9 +111,6 @@ const char *kplugin_strerror(kplugin_error_e error)
 	case KPLUGIN_ERROR_ATTR_NAME:
 		str = "Illegal 'name' attribute";
 		break;
-	case KPLUGIN_ERROR_ATTR_ALIAS:
-		str = "Illegal 'alias' attribute";
-		break;
 	case KPLUGIN_ERROR_ATTR_FILE:
 		str = "Illegal 'file' attribute";
 		break;
@@ -154,15 +144,6 @@ bool_t kplugin_parse(kplugin_t *plugin, const iplugin_t *info, kplugin_error_e *
 		}
 	}
 
-	// Alias
-	if (!faux_str_is_empty(info->alias)) {
-		if (!kplugin_set_alias(plugin, info->alias)) {
-			if (error)
-				*error = KPLUGIN_ERROR_ATTR_ALIAS;
-			return BOOL_FALSE;
-		}
-	}
-
 	// File
 	if (!faux_str_is_empty(info->file)) {
 		if (!kplugin_set_file(plugin, info->file)) {