Re: [PATCH bpf-next v1 2/8] selftests/bpf: Fix arg parsing in veristat, test_progs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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.

...




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux