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

Re: [libvirt] [PATCH v2] util: fix locale problem with virStrToDouble().



Hi Martin,

2017-06-20 11:42 GMT-03:00 Martin Kletzander <mkletzan redhat com>:
> On Sun, Jun 18, 2017 at 03:20:11PM -0300, Julio Faracco wrote:
>>
>> This commit fixes a locale problem with locales that use comma as a
>> mantissa
>> separator. Example: 12.34 en_US = 12,34 pt_BR. Since strtod() is a
>> non-safe
>> function, virStrToDouble() will have problems to parse double numbers from
>> kernel settings and other double numbers from static files (XMLs, JSONs,
>> etc).
>>
>> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1457634
>> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1457481
>>
>> Signed-off-by: Julio Faracco <jcfaracco gmail com>
>> ---
>> src/util/virstring.c | 27 +++++++++++++++++++++++++++
>> 1 file changed, 27 insertions(+)
>>
>
> I don't really like the duplication of the data and code.  I would

I totally agree. I needed to duplicate the code because virDoubleToStr()
is inside virutil as you mentioned.

> rather see virDoubleToStr move to virstring (it can be called
> virStrFromDouble if some don't like the move), it is called from one
> place anyway and that way it can share some of the code and data at
> least.
>

I will join the methods inside virstring and submit a v3.

> I apologize for asking you for yet another version (and possibly
> splitting it into two patches -- the move and the fix), but I haven't
> notice in the previous submission.
>
> Have a nice day,
> Martin

Thanks!


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