lib: Fix a few bugs in trailing_strtoln()
authorSimon Glass <sjg@chromium.org>
Mon, 25 Apr 2022 05:30:57 +0000 (23:30 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 25 Apr 2022 14:00:03 +0000 (10:00 -0400)
commitd667a0d8f413d7278f912aa4e671bc56d28b25f2
tree333f3a7ff758dc6b9a32207fc8061c8f15bcca8a
parent4e64cae0a060c579078de299c6a118aa6f6d7b5b
lib: Fix a few bugs in trailing_strtoln()

At present this has a minor bug in that it reads the byte before the
start of the string, if it is empty. Also it doesn't handle a
non-numeric prefix which is only one character long.

Fix these bugs with a reworked implementation. Add a test for the second
case. The first one is hard to test.

Signed-off-by: Simon Glass <sjg@chromium.org>
include/vsprintf.h
lib/strto.c
test/str_ut.c