From 9c86550d4969109314a5fc279317877ed4647821 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sat, 30 Jan 2021 19:31:28 +0100 Subject: [PATCH] :art: Internally rename template plugins --- src/plug.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plug.c b/src/plug.c index ca461900..2d811c92 100644 --- a/src/plug.c +++ b/src/plug.c @@ -155,8 +155,15 @@ ANN m_bool plugin_ini(struct Gwion_ *gwion, const m_str iname) { const Map map = &gwion->data->plug; for(m_uint i = 0; i < map_size(map); ++i) { const Plug plug = (Plug)VVAL(map, i); - const m_str name = (m_str)VKEY(map, i); - if(!strcmp(name, iname)) { + const m_str base = (m_str)VKEY(map, i); + const size_t size = strlen(iname); + char name[size + 1]; + strcpy(name, iname); + for(size_t i = 0; i < size; i++) { + if(name[i] == ':' || name[i] == '[' || name[i] == ']') + name[i] = '_'; + } + if(!strcmp(name, base)) { if(plug->imp) return GW_OK; const plugin imp = DLSYM(plug->dl, plugin, GWIMPORT_NAME); -- 2.43.0