developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 1 | From c8b9e772aee35e1db245ec6baa7bce1c7b4110ff Mon Sep 17 00:00:00 2001 |
| 2 | From: Johannes Berg <johannes.berg@intel.com> |
| 3 | Date: Fri, 17 May 2024 13:19:47 +0200 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 03/13] util: clarify comment about 'parsed' pointer |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 5 | |
| 6 | It took me a while to understand this (again?), so |
| 7 | clarify the comment here. |
| 8 | |
| 9 | Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com> |
| 10 | Signed-off-by: Johannes Berg <johannes.berg@intel.com> |
| 11 | --- |
| 12 | util.c | 8 ++++++-- |
| 13 | 1 file changed, 6 insertions(+), 2 deletions(-) |
| 14 | |
| 15 | diff --git a/util.c b/util.c |
| 16 | index 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 | -- |
| 35 | 2.18.0 |
| 36 | |