From db2d0013957dae1d971d1139634dde57531ec8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 31 Dec 2023 20:05:06 +0000 Subject: [PATCH] Simplify argc counting. --- posix-runner/posix-runner.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/posix-runner/posix-runner.c b/posix-runner/posix-runner.c index c5891c1..0996791 100644 --- a/posix-runner/posix-runner.c +++ b/posix-runner/posix-runner.c @@ -197,13 +197,8 @@ int sys_execve(char* file_name, char** argv, char** envp, void, void, void) } current_process->entry_point = entry_point(current_process->program.address); - char** iter = argv; int argc; - while(*iter != 0) { - iter += sizeof(char *); - argc += 1; - } - + for(argc = 0; argv[argc] != 0; argc += 1) {} jump(current_process->entry_point, argc, argv, envp); }