lang: Switch to for loops for string iteration
This commit is contained in:
parent
54bf17983c
commit
40c788abd1
1 changed files with 3 additions and 6 deletions
|
@ -82,9 +82,9 @@ static void traverse_module_uses(
|
|||
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 @@ static void traverse_module_uses(
|
|||
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 @@ Object create_module(
|
|||
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 @@ Object create_module(
|
|||
// 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);
|
||||
|
|
Loading…
Add table
Reference in a new issue