aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/mi/miinitext.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/mi/miinitext.c')
-rw-r--r--xorg-server/mi/miinitext.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c
index e5648724c..5b45ab4c2 100644
--- a/xorg-server/mi/miinitext.c
+++ b/xorg-server/mi/miinitext.c
@@ -312,15 +312,13 @@ static void
AddStaticExtensions(void)
{
static Bool listInitialised = FALSE;
- int i;
if (listInitialised)
return;
listInitialised = TRUE;
/* Add built-in extensions to the list. */
- for (i = 0; i < ARRAY_SIZE(staticExtensions); i++)
- LoadExtension(&staticExtensions[i], TRUE);
+ LoadExtensionList(staticExtensions, ARRAY_SIZE(staticExtensions), TRUE);
}
void
@@ -331,7 +329,7 @@ InitExtensions(int argc, char *argv[])
AddStaticExtensions();
- for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
+ for (i = 0; i < numExtensionModules; i++) {
ext = &ExtensionModuleList[i];
if (ext->initFunc != NULL &&
(ext->disablePtr == NULL || !*ext->disablePtr)) {
@@ -341,50 +339,52 @@ InitExtensions(int argc, char *argv[])
}
static ExtensionModule *
-NewExtensionModule(void)
+NewExtensionModuleList(int size)
{
ExtensionModule *save = ExtensionModuleList;
int n;
- /* Make sure built-in extensions get added to the list before those
- * in modules. */
- AddStaticExtensions();
-
/* Sanity check */
if (!ExtensionModuleList)
numExtensionModules = 0;
- n = numExtensionModules + 1;
+ n = numExtensionModules + size;
ExtensionModuleList = realloc(ExtensionModuleList,
- (n + 1) * sizeof(ExtensionModule));
+ n * sizeof(ExtensionModule));
if (ExtensionModuleList == NULL) {
ExtensionModuleList = save;
return NULL;
}
else {
- numExtensionModules++;
- ExtensionModuleList[numExtensionModules].name = NULL;
- return ExtensionModuleList + (numExtensionModules - 1);
+ numExtensionModules += size;
+ return ExtensionModuleList + (numExtensionModules - size);
}
}
void
-LoadExtension(const ExtensionModule * e, Bool builtin)
+LoadExtensionList(const ExtensionModule ext[], int size, Bool builtin)
{
ExtensionModule *newext;
+ const char *msg;
+ int i;
- if (e == NULL || e->name == NULL)
- return;
+ /* Make sure built-in extensions get added to the list before those
+ * in modules. */
+ AddStaticExtensions();
- if (!(newext = NewExtensionModule()))
+ if (!(newext = NewExtensionModuleList(size)))
return;
if (builtin)
- ErrorF("Initializing built-in extension %s\n", e->name);
+ msg = "Initializing built-in";
else
- ErrorF("Loading extension %s\n", e->name);
+ msg = "Loading";
+
+ for (i = 0; i < size; i++, newext++) {
+ ErrorF("%s extension %s\n", msg, ext[i].name);
- newext->name = e->name;
- newext->initFunc = e->initFunc;
- newext->disablePtr = e->disablePtr;
+ newext->name = ext[i].name;
+ newext->initFunc = ext[i].initFunc;
+ newext->disablePtr = ext[i].disablePtr;
+ }
}