[PATCH 4/5] miinitext: avoid allocating a sentinel ExtensionModule
Emil Velikov
emil.l.velikov at gmail.com
Mon Feb 24 14:17:26 PST 2014
Hello gents,
Can someone take a look at this patch please. Keith already covered the
rest of the series but this patch went below his radar.
Thanks
Emil
On 05/02/14 16:20, Emil Velikov wrote:
> With all the logic now in place there is no need to allocate a separate
> ExtensionModule to be used as a sentinel.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
> mi/miinitext.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/mi/miinitext.c b/mi/miinitext.c
> index ce2e4bc..b136818 100644
> --- a/mi/miinitext.c
> +++ b/mi/miinitext.c
> @@ -331,7 +331,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)) {
> @@ -352,14 +352,13 @@ NewExtensionModule(void)
>
> n = numExtensionModules + 1;
> 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);
> }
> }
>
More information about the xorg-devel
mailing list