From: Johannes Berg Date: Fri, 17 May 2024 11:19:47 +0000 (+0200) Subject: util: clarify comment about 'parsed' pointer X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c8b9e772aee35e1db245ec6baa7bce1c7b4110ff;p=thirdparty%2Fiw.git util: clarify comment about 'parsed' pointer It took me a while to understand this (again?), so clarify the comment here. Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- diff --git a/util.c b/util.c index e43d590..1341a22 100644 --- 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)