blob: 4d1b74577da0665b8fcadc024513d854545a3996 [file] [log] [blame]
developer42c7a432024-07-12 14:39:29 +08001From c8b9e772aee35e1db245ec6baa7bce1c7b4110ff Mon Sep 17 00:00:00 2001
2From: Johannes Berg <johannes.berg@intel.com>
3Date: Fri, 17 May 2024 13:19:47 +0200
developer05f3b2b2024-08-19 19:17:34 +08004Subject: [PATCH 03/13] util: clarify comment about 'parsed' pointer
developer42c7a432024-07-12 14:39:29 +08005
6It took me a while to understand this (again?), so
7clarify the comment here.
8
9Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
10Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11---
12 util.c | 8 ++++++--
13 1 file changed, 6 insertions(+), 2 deletions(-)
14
15diff --git a/util.c b/util.c
16index e43d590..1341a22 100644
17--- a/util.c
18+++ b/util.c
19@@ -752,8 +752,12 @@ int parse_freqchan(struct chandef *chandef, bool chan, int argc, char **argv,
20 _parsed++;
21 }
22
23- /* Error out if parsed is NULL. */
24- if (!parsed && _parsed != argc)
25+ /*
26+ * Either this must consume all args, or users must pass a
27+ * valid pointer as 'parsed' and use it to know how many of
28+ * the arguments this function consumed.
29+ */
30+ if (_parsed != argc && !parsed)
31 return 1;
32
33 if (parsed)
34--
352.18.0
36