diff --git a/lang/module.c b/lang/module.c index d41a550..389ffd5 100644 --- a/lang/module.c +++ b/lang/module.c @@ -82,9 +82,9 @@ do { // Use the top of traversal stack as our current module const ModuleInfo *cur = traversing.elems[traversing.next - 1]; + const char **use = NULL; // Iterate through module uses - const char **use = cur->uses; - while (*use) { + for (use = cur->uses; *use != NULL; ++use) { // Find the info associated with the use const ModuleInfo *info = info_by_name(*use); if (info == NULL) @@ -99,7 +99,6 @@ traversing.elems[traversing.next++] = info; break; } - use++; } // No unvisited uses? Mark this module as visited and // retry the module we were traversing before @@ -129,8 +128,7 @@ VmState state, struct module_mapping *mapping, const ModuleInfo *info) { static Object args[16]; unsigned int args_next = 0; - const char **use = info->uses; - while (*use) { + for (const char **use = info->uses; *use != NULL; ++use) { const ModuleInfo *use_info = info_by_name(*use); if (info == NULL) abort_print("Couldn't find module"); @@ -139,7 +137,6 @@ // Check there's enough room left for this and an object_none if (ARRAY_SIZE(args) < (args_next + 1)) abort_print("Too many module args"); - use++; } args[args_next++] = object_none(); Object module = info->create(state);