]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
util: clarify comment about 'parsed' pointer
authorJohannes Berg <johannes.berg@intel.com>
Fri, 17 May 2024 11:19:47 +0000 (13:19 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 5 Jun 2024 11:42:15 +0000 (13:42 +0200)
It took me a while to understand this (again?), so
clarify the comment here.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
util.c

diff --git a/util.c b/util.c
index e43d590a5037d9138608eb8af13b2815fde0dfe5..1341a22ff290057842bf119c605e636d5f00134d 100644 (file)
--- a/util.c
+++ b/util.c
@@ -752,8 +752,12 @@ int parse_freqchan(struct chandef *chandef, bool chan, int argc, char **argv,
                _parsed++;
        }
 
-       /* Error out if parsed is NULL. */
-       if (!parsed && _parsed != argc)
+       /*
+        * Either this must consume all args, or users must pass a
+        * valid pointer as 'parsed' and use it to know how many of
+        * the arguments this function consumed.
+        */
+       if (_parsed != argc && !parsed)
                return 1;
 
        if (parsed)