diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2013-09-26 20:28:37 +0100 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-03-25 16:00:17 -0700 |
commit | e46820fb897600800b5f3297a59039556774e9c5 (patch) | |
tree | 03d3719ce5082e13de2ff61111cb313f113c91b5 /hw | |
parent | d415b9d69fdaab4ce3fc05d3d26b2d8413403aa4 (diff) |
miinitext: introduce LoadExtensionList() to replace over LoadExtension()
Looping around LoadExtension() meant that ExtensionModuleList was reallocated
on every extension. Using LoadExtensionList() we pass an array thus the
function can do the reallocation in one go, and then loop and setup the
ExtensionModuleList.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
v2: Update ephyr [Keith Packard]
v3: Eliminate const warnings in LoadExtensionList [Keith Packard]
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/dmx/dmxinit.c | 4 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrinit.c | 5 | ||||
-rw-r--r-- | hw/vfb/InitOutput.c | 5 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Extensions.c | 5 | ||||
-rw-r--r-- | hw/xfree86/dixmods/glxmodule.c | 8 | ||||
-rw-r--r-- | hw/xfree86/doc/ddxDesign.xml | 4 | ||||
-rw-r--r-- | hw/xquartz/quartz.c | 5 | ||||
-rw-r--r-- | hw/xwin/InitOutput.c | 5 |
8 files changed, 11 insertions, 30 deletions
diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c index 7adcba0bb..fd2ade0ef 100644 --- a/hw/dmx/dmxinit.c +++ b/hw/dmx/dmxinit.c @@ -597,10 +597,8 @@ static void dmxAddExtensions(Bool glxSupported) { GlxExtensionInit, "GLX", &glxSupported }, #endif }; - int i; - for (i = 0; i < ARRAY_SIZE(dmxExtensions); i++) - LoadExtension(&dmxExtensions[i], TRUE); + LoadExtensionList(dmxExtensions, ARRAY_SIZE(dmxExtensions), TRUE); } /** This routine is called in Xserver/dix/main.c from \a main(). */ diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index 807e717b1..fac84cd13 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -65,10 +65,7 @@ static const ExtensionModule ephyrExtensions[] = { static void ephyrExtensionInit(void) { - int i; - - for (i = 0; i < ARRAY_SIZE(ephyrExtensions); i++) - LoadExtension(&ephyrExtensions[i], TRUE); + LoadExtensionList(ephyrExtensions, ARRAY_SIZE(ephyrExtensions), TRUE); } diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index 2175ac685..9c4926462 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -892,10 +892,7 @@ static const ExtensionModule vfbExtensions[] = { static void vfbExtensionInit(void) { - int i; - - for (i = 0; i < ARRAY_SIZE(vfbExtensions); i++) - LoadExtension(&vfbExtensions[i], TRUE); + LoadExtensionList(vfbExtensions, ARRAY_SIZE(vfbExtensions), TRUE); } void diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c index c80de34e6..25b2bc3d0 100644 --- a/hw/xfree86/common/xf86Extensions.c +++ b/hw/xfree86/common/xf86Extensions.c @@ -132,10 +132,7 @@ load_extension_config(void) void xf86ExtensionInit(void) { - int i; - load_extension_config(); - for (i = 0; i < ARRAY_SIZE(extensionModules); i++) - LoadExtension(&extensionModules[i], TRUE); + LoadExtensionList(extensionModules, ARRAY_SIZE(extensionModules), TRUE); } diff --git a/hw/xfree86/dixmods/glxmodule.c b/hw/xfree86/dixmods/glxmodule.c index bf7d182a2..d53c6652d 100644 --- a/hw/xfree86/dixmods/glxmodule.c +++ b/hw/xfree86/dixmods/glxmodule.c @@ -47,10 +47,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static MODULESETUPPROTO(glxSetup); -static const ExtensionModule GLXExt = { - GlxExtensionInit, - "GLX", - &noGlxExtension +static const ExtensionModule GLXExt[] = { + { GlxExtensionInit, "GLX", &noGlxExtension }, }; static XF86ModuleVersionInfo VersRec = { @@ -90,7 +88,7 @@ glxSetup(void *module, void *opts, int *errmaj, int *errmin) GlxPushProvider(provider); } - LoadExtension(&GLXExt, FALSE); + LoadExtensionList(GLXExt, ARRAY_SIZE(GLXExt), FALSE); return module; } diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml index 7c2c20ff3..d1fd9af7b 100644 --- a/hw/xfree86/doc/ddxDesign.xml +++ b/hw/xfree86/doc/ddxDesign.xml @@ -5920,10 +5920,10 @@ These may be moved out of the loader at some point. <blockquote><para> <programlisting> - void LoadExtension(ExtensionModule *ext); + void LoadExtensionList(const ExtensionModule ext[]); </programlisting> <blockquote><para> - This registers the entry points for the extension identified by + This registers the entry points for the extension array identified by <parameter>ext</parameter>. The <structname>ExtensionModule</structname> struct is defined as: diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index bc6c8d048..d7229cecb 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -164,10 +164,7 @@ static const ExtensionModule quartzExtensions[] = { */ static void QuartzExtensionInit(void) { - int i; - - for (i = 0; i < ARRAY_SIZE(quartzExtensions); i++) - LoadExtension(&quartzExtensions[i], TRUE); + LoadExtensionList(quartzExtensions, ARRAY_SIZE(quartzExtensions), TRUE); } /* diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index b3ff7c041..6b5c38d92 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -163,8 +163,6 @@ static const ExtensionModule xwinExtensions[] = { static void XwinExtensionInit(void) { - int i; - #ifdef XWIN_GLX_WINDOWS if (g_fNativeGl) { /* install the native GL provider */ @@ -172,8 +170,7 @@ void XwinExtensionInit(void) } #endif - for (i = 0; i < ARRAY_SIZE(xwinExtensions); i++) - LoadExtension(&xwinExtensions[i], TRUE); + LoadExtensionList(xwinExtensions, ARRAY_SIZE(xwinExtensions), TRUE); } #if defined(DDXBEFORERESET) |