[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZqRq2MB/axSchiQP@kodidev-ubuntu>
Date: Fri, 26 Jul 2024 20:34:48 -0700
From: Tony Ambardar <tony.ambardar@...il.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: bpf@...r.kernel.org, linux-kselftest@...r.kernel.org,
netdev@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
Björn Töpel <bjorn@...nel.org>,
Magnus Karlsson <magnus.karlsson@...el.com>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Jonathan Lemon <jonathan.lemon@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Yan Zhai <yan@...udflare.com>
Subject: Re: [PATCH bpf-next v1 2/8] selftests/bpf: Fix arg parsing in
veristat, test_progs
On Thu, Jul 25, 2024 at 01:09:24PM -0700, Andrii Nakryiko wrote:
> On Thu, Jul 25, 2024 at 3:39 AM Tony Ambardar <tony.ambardar@...il.com> wrote:
> >
...
> > --- a/tools/testing/selftests/bpf/testing_helpers.c
> > +++ b/tools/testing/selftests/bpf/testing_helpers.c
> > @@ -227,7 +227,7 @@ int parse_test_list(const char *s,
> > if (!input)
> > return -ENOMEM;
> >
> > - while ((test_spec = strtok_r(state ? NULL : input, ",", &state))) {
> > + for (test_spec = strtok_r(input, ",", &state); test_spec; test_spec = strtok_r(NULL, ",", &state)) {
>
> oh, this is so long and verbose, let's just add a counter and use that
> to determine whether to pass NULL or input, ok?
>
...
> > - while ((next = strtok_r(state ? NULL : input, ",", &state))) {
> > + for (next = strtok_r(input, ",", &state); next; next = strtok_r(NULL, ",", &state)) {
>
> ditto, let's not duplicate strtok_r() calls
>
Sounds good. I'll update for v2 and thanks for the suggestion.
...
Powered by blists - more mailing lists