qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Collin L. Walling" <walling@linux.vnet.ibm.com>
To: Thomas Huth <thuth@redhat.com>, Eric Blake <eblake@redhat.com>,
	qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: alifm@linux.vnet.ibm.com, frankja@linux.vnet.ibm.com,
	cohuck@redhat.com, borntraeger@de.ibm.com, david@redhat.com
Subject: Re: [Qemu-devel] [qemu-s390x] [PATCH v3 1/8] s390-ccw: update libc
Date: Tue, 16 Jan 2018 12:19:38 -0500	[thread overview]
Message-ID: <d6805f2b-34b2-7e1f-f27b-1b244e5c36df@linux.vnet.ibm.com> (raw)
In-Reply-To: <272fa2f6-8a75-3c05-e373-d7d1b65a7e23@redhat.com>

On 01/16/2018 05:00 AM, Thomas Huth wrote:
> On 15.01.2018 18:23, Collin L. Walling wrote:
>> On 01/15/2018 12:05 PM, Eric Blake wrote:
>>> On 01/15/2018 10:44 AM, Collin L. Walling wrote:
> [...]
>>>> +/**
>>>> + * atoi:
>>>> + * @str: the string to be converted.
>>>> + *
>>>> + * Given a string @str, convert it to an integer. Any non-numerical
>>>> value
>>>> + * will terminate the conversion.
>>>> + *
>>>> + * Returns: an integer converted from the string @str.
>>>> + */
>>>> +int atoi(const char *str)
>>>> +{
>>>> +    int i;
>>>> +    int val = 0;
>>>> +
>>>> +    for (i = 0; str[i]; i++) {
>>>> +        char c = str[i];
>>>> +        if (!isdigit(c)) {
>>>> +            break;
>>>> +        }
>>>> +        val *= 10;
>>>> +        val += c - '0';
>>> Silently gives garbage on integer overflow, but matches the fact that
>>> POSIX atoi() can't flag errors.  However, it does not handle leading
>>> whitespace nor '-', which means it is NOT doing a POSIX-compatible
>>> atoi() implementation; naming it atoi() is perhaps thus a disservice to
>>> end users.
>> Fair enough. Perhaps the "strtoi" convention suits this better.
> Or maybe simply add an assert(str[0] != '-') for now. If we ever hit the
> assert, we can still add the support for negative numbers if necessary.


Eh... honestly it's easy enough to just add a flag for the negative sign
and handle it at the end.  We don't need it for this patch series, but at
least the support will be there. :)

[...]

-- 
- Collin L Walling

  reply	other threads:[~2018-01-16 17:19 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-15 16:44 [Qemu-devel] [PATCH v3 0/8] Interactive Boot Menu for DASD and SCSI Guests on s390x Collin L. Walling
2018-01-15 16:44 ` [Qemu-devel] [PATCH v3 1/8] s390-ccw: update libc Collin L. Walling
2018-01-15 17:05   ` Eric Blake
2018-01-15 17:23     ` Collin L. Walling
2018-01-16 10:00       ` Thomas Huth
2018-01-16 17:19         ` Collin L. Walling [this message]
2018-01-16 11:07       ` [Qemu-devel] [qemu-s390x] " Christian Borntraeger
2018-01-16 15:32         ` Collin L. Walling
2018-01-16 15:48           ` Thomas Huth
2018-01-15 16:44 ` [Qemu-devel] [PATCH v3 2/8] s390-ccw: ipl structs for eckd cdl/ldl Collin L. Walling
2018-01-16 12:32   ` Thomas Huth
2018-01-16 15:21     ` [Qemu-devel] [qemu-s390x] " Collin L. Walling
2018-01-15 16:44 ` [Qemu-devel] [PATCH v3 3/8] s390-ccw: parse and set boot menu options Collin L. Walling
2018-01-16 12:44   ` Thomas Huth
2018-01-16 15:26     ` [Qemu-devel] [qemu-s390x] " Collin L. Walling
2018-01-15 16:44 ` [Qemu-devel] [PATCH v3 4/8] s390-ccw: interactive boot menu for eckd dasd (menu setup) Collin L. Walling
2018-01-16 18:23   ` Thomas Huth
2018-01-16 19:37     ` [Qemu-devel] [qemu-s390x] " Collin L. Walling
2018-01-17  6:11       ` Thomas Huth
2018-01-17 12:12         ` Collin L. Walling
2018-01-15 16:44 ` [Qemu-devel] [PATCH v3 5/8] s390-ccw: interactive boot menu for eckd dasd (read stage2 data) Collin L. Walling
2018-01-17  8:38   ` Thomas Huth
2018-01-17  9:12     ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-01-17 12:29     ` Collin L. Walling
2018-01-15 16:44 ` [Qemu-devel] [PATCH v3 6/8] s390-ccw: interactive boot menu for eckd dasd (print menu) Collin L. Walling
2018-01-17  8:58   ` Thomas Huth
2018-01-15 16:44 ` [Qemu-devel] [PATCH v3 7/8] s390-ccw: interactive boot menu for eckd dasd (read input) Collin L. Walling
2018-01-17 10:10   ` Thomas Huth
2018-01-17 13:19     ` [Qemu-devel] [qemu-s390x] " Collin L. Walling
2018-01-15 16:44 ` [Qemu-devel] [PATCH v3 8/8] s390-ccw: interactive boot menu for scsi Collin L. Walling
2018-01-17 10:16   ` Thomas Huth
2018-01-15 16:58 ` [Qemu-devel] [PATCH v3 0/8] Interactive Boot Menu for DASD and SCSI Guests on s390x no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6805f2b-34b2-7e1f-f27b-1b244e5c36df@linux.vnet.ibm.com \
    --to=walling@linux.vnet.ibm.com \
    --cc=alifm@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=eblake@redhat.com \
    --cc=frankja@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).