Skip to content

tools/nolibc: fix standard conformance of a few string functions

Arav Verma linux-kselftest lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3tools/nolibc: fix strchr() and strrchr() for the NUL terminatortools/include/nolibc/string.h tools/testing/selftests/nolibc/nolibc-test.c+6 -60 replies
2/3tools/nolibc: fix strstr() with an empty needletools/include/nolibc/string.h tools/testing/selftests/nolibc/nolibc-test.c+2 -10 replies
3/3tools/nolibc: make atoi() and atol() skip whitespace and accept '+'tools/include/nolibc/stdlib.h tools/testing/selftests/nolibc/nolibc-test.c+11 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] tools/nolibc: fix standard conformance of a few string functions

A few nolibc functions deviate from the C standard in corner cases:
strchr()/strrchr() do not find the terminating NUL, strstr() returns NULL for an empty needle, and atoi()/atol() do not skip leading whitespace or accept a '+' sign.

Fix them and add test cases. The new tests fail without the fixes. The results were also compared against glibc.

Arav Verma (3):
tools/nolibc: fix strchr() and strrchr() for the NUL terminator tools/nolibc: fix strstr() with an empty needle tools/nolibc: make atoi() and atol() skip whitespace and accept '+'

 tools/include/nolibc/stdlib.h                |  5 +++++
 tools/include/nolibc/string.h                | 12 +++++-------
 tools/testing/selftests/nolibc/nolibc-test.c |  9 +++++++++
 3 files changed, 19 insertions(+), 7 deletions(-)
Signature · 1 line
2.47.3