On Mon, Jul 22, 2013 at 01:44:46PM +1000, [email protected] wrote: > From: Maarten Lankhorst <[email protected]> > > Signed-off-by: Christopher James Halse Rogers > <[email protected]> > --- > hw/xfree86/common/xf86Helper.c | 9 ++++++++- > hw/xfree86/common/xf86Init.c | 8 ++++++-- > 2 files changed, 14 insertions(+), 3 deletions(-) > > diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c > index 721159d..d319e0c 100644 > --- a/hw/xfree86/common/xf86Helper.c > +++ b/hw/xfree86/common/xf86Helper.c > @@ -100,7 +100,14 @@ xf86DeleteDriver(int drvIndex) > if (xf86DriverList[drvIndex]->module) > UnloadModule(xf86DriverList[drvIndex]->module); > free(xf86DriverList[drvIndex]); > - xf86DriverList[drvIndex] = NULL; > + > + /* Compact xf86DriverList array, update xf86NumDrivers */ > + xf86NumDrivers--; > + if(drvIndex != xf86NumDrivers) > + memmove(xf86DriverList + drvIndex, > + xf86DriverList + drvIndex + 1, > + sizeof(DriverPtr) * (xf86NumDrivers - drvIndex)); > + xf86DriverList = realloc(xf86DriverList, xf86NumDrivers * > sizeof(DriverPtr)); > } > } > > diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c > index 91ec4c8..746168a 100644 > --- a/hw/xfree86/common/xf86Init.c > +++ b/hw/xfree86/common/xf86Init.c > @@ -530,7 +530,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char > **argv) > * needed at this early stage. > */ > > - for (i = 0; i < xf86NumDrivers; i++) { > + for (i = 0; i < xf86NumDrivers; ) {
no. please use a while loop for this. for loops without an increment condition are just plain ugly. also, as Mark pointed out it's not sure why this change is needed. Cheers, Peter > xorgHWFlags flags = HW_IO; > > if (xf86DriverList[i]->Identify != NULL) > @@ -546,6 +546,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char > **argv) > > if (!(flags & HW_SKIP_CONSOLE)) > xorgHWOpenConsole = TRUE; > + > + i++; > } > > if (xorgHWOpenConsole) > @@ -631,9 +633,11 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char > **argv) > } > > /* Remove (unload) drivers that are not required */ > - for (i = 0; i < xf86NumDrivers; i++) > + for (i = 0; i < xf86NumDrivers; ) > if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0) > xf86DeleteDriver(i); > + else > + i++; > > /* > * At this stage we know how many screens there are. > -- > 1.8.3.2 > > _______________________________________________ > [email protected]: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: http://lists.x.org/mailman/listinfo/xorg-devel > _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
