[libvirt] [PATCHv2] maint: Kill usage of atoi()

Eric Blake eblake at redhat.com
Thu Nov 14 21:53:36 UTC 2013


On 11/14/2013 02:22 PM, Peter Krempa wrote:

>>> +
>>> +exclude_file_name_regexp--sc_prohibit_atoi= \
>>> +	^examples/.*\.[ch]$$
>>
>> Drop this hunk.  None of our examples/* use atoi to begin with, so
>> there's no reason to exclude them from the syntax check.
>>
>> ACK with those fixes.
>>
> 
> This isn't true unfortunately:

Huh, wonder what grep I did that missed that fact?

> 
> ~/libvirt $ git grep atoi examples/
> examples/domsuspend/suspend.c:        id = atoi(argv[1]);
> 
> and I wanted to avoid changing that file. But if you insist I can tune
> that one too.

Yes, it's worth fixing, because our examples should never teach people
to use bad coding practices.  atoi() is broken by design, and strtol(),
while more awkward to use, is just as portably present as atoi().

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131114/979ca8ac/attachment-0001.sig>


More information about the libvir-list mailing list