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

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

 



On 11/14/13 22:53, Eric Blake wrote:
> 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().
> 

Well, the file is a bad example by itself. The first issue would be that
it doesn't work. It tries to suspend(pause) a VM using the RO connection.

That file should be refactored as a whole piece instead of trying to
polish parts that won't even work.

Peter

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]