The full DSO name no longer needs to be specified to load an external mode

This commit is contained in:
Scoopta 2020-03-13 12:30:00 -07:00
parent b2e879cc88
commit b182442f7a

View File

@ -1237,6 +1237,18 @@ static struct mode* add_mode(char* _mode) {
struct map* props = map_init(); struct map* props = map_init();
void (*init)(struct mode* _mode, struct map* props) = load_mode(_mode, mode_ptr, props); void (*init)(struct mode* _mode, struct map* props) = load_mode(_mode, mode_ptr, props);
if(init == NULL) {
free(mode_ptr->name);
free(mode_ptr);
map_free(props);
mode_ptr = calloc(1, sizeof(struct mode));
props = map_init();
char* name = utils_concat(3, "lib", _mode, ".so");
init = load_mode(name, mode_ptr, props);
free(name);
if(init == NULL) { if(init == NULL) {
free(mode_ptr->name); free(mode_ptr->name);
free(mode_ptr); free(mode_ptr);
@ -1254,6 +1266,7 @@ static struct mode* add_mode(char* _mode) {
exit(1); exit(1);
} }
} }
}
map_put_void(modes, _mode, mode_ptr); map_put_void(modes, _mode, mode_ptr);
init(mode_ptr, props); init(mode_ptr, props);