From 07371eb00331cc0ba13d9f16c5ad4fb786dcebc8 Mon Sep 17 00:00:00 2001 From: Eero Pomell <97628152+Password-and-authentication@users.noreply.github.com> Date: Wed, 17 Aug 2022 21:55:38 +0300 Subject: [PATCH] Improve countargv() Countargv() changed from a for loop to a while loop --- libiberty/argv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libiberty/argv.c b/libiberty/argv.c index 10d5c3060b5bf..7ec018b1b2207 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -507,12 +507,12 @@ Returns zero if @var{argv} is NULL. int countargv (char * const *argv) { - int argc; + int argc = 0; if (argv == NULL) return 0; - for (argc = 0; argv[argc] != NULL; argc++) - continue; + while (argv[argc++]) + ; return argc; }