[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [qemu-s390x] [Qemu-devel] [PATCH v4 04/10] s390-ccw: update libc
From: |
Eric Blake |
Subject: |
Re: [qemu-s390x] [Qemu-devel] [PATCH v4 04/10] s390-ccw: update libc |
Date: |
Thu, 25 Jan 2018 09:08:09 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 01/25/2018 06:06 AM, Thomas Huth wrote:
>>> That's not "any whitespace", but only spaces. A fully compliant
>>> implementation would be checking isspace(), but I don't expect you to
>>> implement that; at a minimum, also checking '\t' would get you closer
>>> (but not all the way to) compliance.
>>
>>
>> I'll fix the comment to be more clear.
>>
>> I think it's okay to just have the menu code treat any other kind
>> of whitespace as an error (it will check before calling atoi). I
>> added support for negatives in bothfunctions because it was easy
>> enough to do so and for the sakeof completeness.
>>
>> However, I worry trying to be 100% compliant will just bloat the
>> code when we only need it for very specific use cases.
>>
>> Would you say what we have (along with the fix to itostr below) is
>> sufficient enough?
>
> IMHO the current way is good enough for a BIOS implementation. We're not
> doing a full replacement of glibc here ;-)
Documenting the issue is the best approach; don't bloat the code for
something that none of the callers care about. Perhaps as simple as adding:
NOTE: This function is not quite like the standardized version in libc;
it does not handle all forms of leading space or INT_MIN.
(or whatever the actual differences are, based on your implementation
choices).
Another solution is to just not use the standardized name; keeping it
named _atoi() instead of atoi() makes it obvious that you are calling an
internal function that does not have to have standardized semantics.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [qemu-s390x] [PATCH v4 02/10] s390-ccw: refactor eckd_block_num to use CHS, (continued)
[qemu-s390x] [PATCH v4 03/10] s390-ccw: refactor IPL structs, Collin L. Walling, 2018/01/23
[qemu-s390x] [PATCH v4 04/10] s390-ccw: update libc, Collin L. Walling, 2018/01/23
[qemu-s390x] [PATCH v4 06/10] s390-ccw: set up interactive boot menu parameters, Collin L. Walling, 2018/01/23
[qemu-s390x] [PATCH v4 05/10] s390-ccw: parse and set boot menu options, Collin L. Walling, 2018/01/23
[qemu-s390x] [PATCH v4 07/10] s390-ccw: read stage2 boot loader data to find menu, Collin L. Walling, 2018/01/23
[qemu-s390x] [PATCH v4 09/10] s390-ccw: read user input for boot index via the SCLP console, Collin L. Walling, 2018/01/23