diff options
author | Michal Suchanek <hramrach@centrum.cz> | 2011-10-08 14:26:24 +0200 |
---|---|---|
committer | Michal Suchanek <hramrach@centrum.cz> | 2011-10-18 14:21:32 +0200 |
commit | df0dd36deea0c756819825113e825059ddd19243 (patch) | |
tree | fd1d56b25a01fe7df13d32065c4ece53354074d8 | |
parent | 24d435163eb5fbd9b73cd8ba13a9b3cdbbe8a1df (diff) |
Do not uselessly reload modules in DuplicateModule
The function does not initialize the module so it has no business
loading it. If some user of DuplicateModule expects a module actually
loaded they should use LoadModule.
Signed-off-by: Michal Suchanek <hramrach@centrum.cz>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | hw/xfree86/loader/loadmod.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 2e6c667c2..a21f43d63 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -94,6 +94,8 @@ const ModuleVersions LoaderVersionInfo = { ABI_FONT_VERSION }; +static int ModuleDuplicated[] = {}; + static void FreeStringList(char **paths) { @@ -785,7 +787,6 @@ ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent) { ModuleDescPtr ret; - int errmaj, errmin; if (!mod) return NULL; @@ -794,14 +795,11 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent) if (ret == NULL) return NULL; - if (!(ret->handle = LoaderOpen(mod->path, &errmaj, &errmin))) { - free(ret); - return NULL; - } + ret->handle = mod->handle; ret->SetupProc = mod->SetupProc; ret->TearDownProc = mod->TearDownProc; - ret->TearDownData = NULL; + ret->TearDownData = ModuleDuplicated; ret->child = DuplicateModule(mod->child, ret); ret->sib = DuplicateModule(mod->sib, parent); ret->parent = parent; @@ -1077,9 +1075,11 @@ UnloadModuleOrDriver(ModuleDescPtr mod) else xf86MsgVerb(X_INFO, 3, "UnloadModule: \"%s\"\n", mod->name); - if ((mod->TearDownProc) && (mod->TearDownData)) - mod->TearDownProc(mod->TearDownData); - LoaderUnload(mod->name, mod->handle); + if (mod->TearDownData != ModuleDuplicated) { + if ((mod->TearDownProc) && (mod->TearDownData)) + mod->TearDownProc(mod->TearDownData); + LoaderUnload(mod->name, mod->handle); + } if (mod->child) UnloadModuleOrDriver(mod->child); |