qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 08/19] cutils: Allow NULL endptr in parse_uint()


From: Hanna Czenczek
Subject: Re: [PATCH v2 08/19] cutils: Allow NULL endptr in parse_uint()
Date: Fri, 19 May 2023 16:54:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

On 12.05.23 04:10, Eric Blake wrote:
All the qemu_strto*() functions permit a NULL endptr, just like their
libc counterparts, leaving parse_uint() as the oddball that caused
SEGFAULT on NULL and required the user to call parse_uint_full()
instead.  Relax things for consistency, even though the testsuite is
the only impacted caller.  Add one more unit test to ensure even
parse_uint_full(NULL, 0, &value) works.  This also fixes our code to
uniformly favor EINVAL over ERANGE when both apply.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
  tests/unit/test-cutils.c | 18 ++++++++++++++++--
  util/cutils.c            | 34 ++++++++++++----------------------
  2 files changed, 28 insertions(+), 24 deletions(-)

Reviewed-by: Hanna Czenczek <hreitz@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]