summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2012-07-10 02:03:00 +0100
committerKeith Packard <keithp@keithp.com>2012-07-09 23:28:23 -0700
commitd785368e0e171080fea5447c87e81c93f515ff21 (patch)
tree975b0f7c3b4ad8ed2c9f775f95bf5cd412cb1394 /mi
parentf48d8f58b39af0036365368d6ac35319d6d856d5 (diff)
miinitext: Use ARRAY_SIZE rather than sentinel
NULL sentinels are totally lame. v2: numExtensionModules isn't public, so keep using the provided sentinal - Keith Packard <keithp@keithp.com> Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Stéphane Marchesin <stephane.marchesin@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'mi')
-rw-r--r--mi/miinitext.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mi/miinitext.c b/mi/miinitext.c
index ef20a116d..7b5eef6f4 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -172,15 +172,16 @@ static ExtensionToggle ExtensionToggleList[] = {
#ifdef XV
{"XVideo", &noXvExtension},
#endif
- {NULL, NULL}
};
Bool
EnableDisableExtension(const char *name, Bool enable)
{
- ExtensionToggle *ext = &ExtensionToggleList[0];
+ ExtensionToggle *ext;
+ int i;
- for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
+ for (i = 0; i < ARRAY_SIZE(ExtensionToggleList); i++) {
+ ext = &ExtensionToggleList[i];
if (strcmp(name, ext->name) == 0) {
if (ext->disablePtr != NULL) {
*ext->disablePtr = !enable;
@@ -396,7 +397,6 @@ static ExtensionModule staticExtensions[] = {
#ifdef DAMAGE
{DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL},
#endif
- {NULL, NULL, NULL, NULL, NULL}
};
/*ARGSUSED*/ void
@@ -408,7 +408,7 @@ InitExtensions(int argc, char *argv[])
if (!listInitialised) {
/* Add built-in extensions to the list. */
- for (i = 0; staticExtensions[i].name; i++)
+ for (i = 0; i < ARRAY_SIZE(staticExtensions); i++)
LoadExtension(&staticExtensions[i], TRUE);
/* Sort the extensions according the init dependencies. */