diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2013-09-26 20:16:31 +0100 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2014-03-23 18:18:56 +0000 |
commit | d415b9d69fdaab4ce3fc05d3d26b2d8413403aa4 (patch) | |
tree | b35626b39340e540c339cb964967ec32d02d910b /mi | |
parent | b421ac8e026f464fdba2082aaedc00c19fb8b6c7 (diff) |
miinitext: avoid allocating a sentinel ExtensionModule
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@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'mi')
-rw-r--r-- | mi/miinitext.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/mi/miinitext.c b/mi/miinitext.c index ce2e4bcd4..b13681820 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); } } |