Thread (29 messages) flat view 29 messages, 3 authors, 2024-07-30

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

From: Tony Ambardar <hidden>
Date: 2024-07-27 03:34:52
Also in: bpf, linux-kselftest

On Thu, Jul 25, 2024 at 01:09:24PM -0700, Andrii Nakryiko wrote:
On Thu, Jul 25, 2024 at 3:39 AM Tony Ambardar [off-list ref] wrote:
quoted
...
quoted
--- 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?
...
quoted
-       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.

...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help