[libvirt] [PATCH] util: Extract locale-related fixes into separate functions

Martin Kletzander mkletzan at redhat.com
Fri Jun 23 08:21:32 UTC 2017

On Thu, Jun 22, 2017 at 03:49:03PM +0200, Peter Krempa wrote:
>On Thu, Jun 22, 2017 at 14:36:53 +0200, Martin Kletzander wrote:
>> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
>> ---
>>  src/util/virstring.c | 96 ++++++++++++++++++++++++++++++++--------------------
>>  1 file changed, 60 insertions(+), 36 deletions(-)
>> diff --git a/src/util/virstring.c b/src/util/virstring.c
>> index feea5be05198..6125725364f3 100644
>> --- a/src/util/virstring.c
>> +++ b/src/util/virstring.c
>> @@ -522,6 +522,7 @@ virStrToLong_ullp(char const *s, char **end_ptr, int base,
>>  static locale_t virLocale;
>> +static locale_t virLocaleOld;
>This is not a thread local variable ...

Oh. shoot, you're right.  So we need to wrap it in our struct that will
be defined conditionally as well, or allocate it on the heap, copy it
there and set a pointer to it as one additional parameter or make thread
local variable, but that one will need to be a pointer to the locale, so
we'll need to allocate it on the heap as well.  I don't like the way
this is going.  Anyone else feel free to continue on this if you want to
clean this up, but I like the few small conditional blocks better,
especially since we have them in only two functions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170623/53fd97ba/attachment-0001.sig>

More information about the libvir-list mailing list