summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2012-07-10 02:03:19 +0100
committerKeith Packard <keithp@keithp.com>2012-07-10 00:31:02 -0700
commit2fba9445a0357f67641e41ac334b5529c37774a2 (patch)
tree2205cbf8dbeeb3063e6f763b3a04ea2618423bc8
parent9a953e0e9dcb8a8e43cc27ffaef460268fbe1916 (diff)
Add static extensions before those in modules
Make sure we add static extensions before anything in a module. This is more or less a no-op at the moment, but will come in handy later when extension dependency sorting is removed. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--hw/xfree86/common/xf86Module.h5
-rw-r--r--hw/xfree86/loader/loadext.c4
-rw-r--r--mi/miinitext.c31
3 files changed, 29 insertions, 11 deletions
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index c48f041d1..dc5d0a8e8 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -180,6 +180,11 @@ typedef struct {
extern _X_EXPORT ExtensionModule *ExtensionModuleList;
+/* This really shouldn't be here, but gets moved in about three commits'
+ * time. So odds are the only people who ever see this comment are doing
+ * patch review, in which case, thanks! */
+extern _X_EXPORT void AddStaticExtensions(void);
+
/* Prototypes for Loader functions that are exported to modules */
extern _X_EXPORT pointer LoadSubModule(pointer, const char *, const char **,
const char **, pointer,
diff --git a/hw/xfree86/loader/loadext.c b/hw/xfree86/loader/loadext.c
index daa1abf8d..0754ea986 100644
--- a/hw/xfree86/loader/loadext.c
+++ b/hw/xfree86/loader/loadext.c
@@ -49,6 +49,10 @@ NewExtensionModule(void)
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;
diff --git a/mi/miinitext.c b/mi/miinitext.c
index a8644db6b..30c428c8a 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -421,22 +421,31 @@ static ExtensionModule staticExtensions[] = {
#endif
};
- /*ARGSUSED*/ void
+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);
+}
+
+void
InitExtensions(int argc, char *argv[])
{
int i;
ExtensionModule *ext;
- static Bool listInitialised = FALSE;
-
- if (!listInitialised) {
- /* Add built-in extensions to the list. */
- for (i = 0; i < ARRAY_SIZE(staticExtensions); i++)
- LoadExtension(&staticExtensions[i], TRUE);
- /* Sort the extensions according the init dependencies. */
- LoaderSortExtensions();
- listInitialised = TRUE;
- }
+ /* Make sure all static extensions have been added, then sort the
+ * extensions according to their init dependencies. */
+ AddStaticExtensions();
+ LoaderSortExtensions();
for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
ext = &ExtensionModuleList[i];