Remove some braindamage from ModuleDesc.
Yay dead code elimination.
This commit is contained in:
parent
e91ff09568
commit
f750ce53ac
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
|
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
|
|
@ -62,17 +62,11 @@ typedef struct module_desc {
|
||||||
struct module_desc *child;
|
struct module_desc *child;
|
||||||
struct module_desc *sib;
|
struct module_desc *sib;
|
||||||
struct module_desc *parent;
|
struct module_desc *parent;
|
||||||
struct module_desc *demand_next;
|
|
||||||
char *name;
|
char *name;
|
||||||
char *filename;
|
|
||||||
char *identifier;
|
|
||||||
XID client_id;
|
|
||||||
int in_use;
|
|
||||||
int handle;
|
int handle;
|
||||||
ModuleSetupProc SetupProc;
|
ModuleSetupProc SetupProc;
|
||||||
ModuleTearDownProc TearDownProc;
|
ModuleTearDownProc TearDownProc;
|
||||||
void *TearDownData; /* returned from SetupProc */
|
void *TearDownData; /* returned from SetupProc */
|
||||||
const char *path;
|
|
||||||
const XF86ModuleVersionInfo *VersionInfo;
|
const XF86ModuleVersionInfo *VersionInfo;
|
||||||
} ModuleDesc, *ModuleDescPtr;
|
} ModuleDesc, *ModuleDescPtr;
|
||||||
|
|
||||||
|
|
|
@ -786,12 +786,7 @@ NewModuleDesc(const char *name)
|
||||||
mdp->child = NULL;
|
mdp->child = NULL;
|
||||||
mdp->sib = NULL;
|
mdp->sib = NULL;
|
||||||
mdp->parent = NULL;
|
mdp->parent = NULL;
|
||||||
mdp->demand_next = NULL;
|
|
||||||
mdp->name = xstrdup(name);
|
mdp->name = xstrdup(name);
|
||||||
mdp->filename = NULL;
|
|
||||||
mdp->identifier = NULL;
|
|
||||||
mdp->client_id = 0;
|
|
||||||
mdp->in_use = 0;
|
|
||||||
mdp->handle = -1;
|
mdp->handle = -1;
|
||||||
mdp->SetupProc = NULL;
|
mdp->SetupProc = NULL;
|
||||||
mdp->TearDownProc = NULL;
|
mdp->TearDownProc = NULL;
|
||||||
|
@ -816,15 +811,10 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent)
|
||||||
if (LoaderHandleOpen(mod->handle) == -1)
|
if (LoaderHandleOpen(mod->handle) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret->filename = xstrdup(mod->filename);
|
|
||||||
ret->identifier = mod->identifier;
|
|
||||||
ret->client_id = mod->client_id;
|
|
||||||
ret->in_use = mod->in_use;
|
|
||||||
ret->handle = mod->handle;
|
ret->handle = mod->handle;
|
||||||
ret->SetupProc = mod->SetupProc;
|
ret->SetupProc = mod->SetupProc;
|
||||||
ret->TearDownProc = mod->TearDownProc;
|
ret->TearDownProc = mod->TearDownProc;
|
||||||
ret->TearDownData = NULL;
|
ret->TearDownData = NULL;
|
||||||
ret->path = mod->path;
|
|
||||||
ret->child = DuplicateModule(mod->child, ret);
|
ret->child = DuplicateModule(mod->child, ret);
|
||||||
ret->sib = DuplicateModule(mod->sib, parent);
|
ret->sib = DuplicateModule(mod->sib, parent);
|
||||||
ret->parent = parent;
|
ret->parent = parent;
|
||||||
|
@ -943,8 +933,6 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
|
||||||
if (ret->handle < 0)
|
if (ret->handle < 0)
|
||||||
goto LoadModule_fail;
|
goto LoadModule_fail;
|
||||||
|
|
||||||
ret->filename = xstrdup(found);
|
|
||||||
|
|
||||||
/* drop any explicit suffix from the module name */
|
/* drop any explicit suffix from the module name */
|
||||||
p = strchr(name, '.');
|
p = strchr(name, '.');
|
||||||
if (p)
|
if (p)
|
||||||
|
@ -998,7 +986,6 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
|
||||||
ret->SetupProc = setup;
|
ret->SetupProc = setup;
|
||||||
if (teardown)
|
if (teardown)
|
||||||
ret->TearDownProc = teardown;
|
ret->TearDownProc = teardown;
|
||||||
ret->path = path;
|
|
||||||
ret->VersionInfo = vers;
|
ret->VersionInfo = vers;
|
||||||
} else {
|
} else {
|
||||||
/* No initdata is OK for external modules */
|
/* No initdata is OK for external modules */
|
||||||
|
@ -1120,7 +1107,6 @@ UnloadModuleOrDriver(ModuleDescPtr mod)
|
||||||
if (mod->sib)
|
if (mod->sib)
|
||||||
UnloadModuleOrDriver(mod->sib);
|
UnloadModuleOrDriver(mod->sib);
|
||||||
TestFree(mod->name);
|
TestFree(mod->name);
|
||||||
TestFree(mod->filename);
|
|
||||||
xfree(mod);
|
xfree(mod);
|
||||||
#ifdef __alpha__
|
#ifdef __alpha__
|
||||||
istream_mem_barrier();
|
istream_mem_barrier();
|
||||||
|
@ -1145,7 +1131,6 @@ UnloadSubModule(ModuleDescPtr mod)
|
||||||
UnloadModuleOrDriver(mod->child);
|
UnloadModuleOrDriver(mod->child);
|
||||||
|
|
||||||
TestFree(mod->name);
|
TestFree(mod->name);
|
||||||
TestFree(mod->filename);
|
|
||||||
xfree(mod);
|
xfree(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,12 +1141,6 @@ FreeModuleDesc(ModuleDescPtr head)
|
||||||
|
|
||||||
if (head == (ModuleDescPtr) 1)
|
if (head == (ModuleDescPtr) 1)
|
||||||
return;
|
return;
|
||||||
/*
|
|
||||||
* only free it if it's not marked as in use. In use means that it may
|
|
||||||
* be unloaded someday, and UnloadModule will free it
|
|
||||||
*/
|
|
||||||
if (head->in_use)
|
|
||||||
return;
|
|
||||||
if (head->child)
|
if (head->child)
|
||||||
FreeModuleDesc(head->child);
|
FreeModuleDesc(head->child);
|
||||||
sibs = head;
|
sibs = head;
|
||||||
|
|
Loading…
Reference in New Issue