Re: [PATCH 1/3] virsh: modify vshStringToArray to duplicate the elements too

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

 



On 08/20/13 12:01, Osier Yang wrote:
> On 20/08/13 17:20, Peter Krempa wrote:
>> On 08/20/13 11:16, Osier Yang wrote:
>>> On 20/08/13 17:05, Peter Krempa wrote:
>>>> At a slightly larger memory expense allow stealing of items from the
>>>> string array returned from vshStringToArray and turn the result into a
>>>> string list compatible with virStringSplit. This will allow to use the
>>>> common dealloc function.
>>>>
>>>> This patch also fixes a few forgotten checks of return from
>>>> vshStringToArray and one memory leak.
>>>> ---
>>>>    tools/virsh-nodedev.c  | 18 +++++-------------
>>>>    tools/virsh-pool.c     | 10 ++++------
>>>>    tools/virsh-snapshot.c | 10 ++--------
>>>>    tools/virsh.c          |  8 +++++---
>>>>    tools/virsh.h          |  1 +
>>>>    5 files changed, 17 insertions(+), 30 deletions(-)
>>>>
>> ...
>>
>>>> diff --git a/tools/virsh.c b/tools/virsh.c
>>>> index f65dc79..d6e3cb3 100644
>>>> --- a/tools/virsh.c
>>>> +++ b/tools/virsh.c
>>>> @@ -196,7 +196,8 @@ vshStringToArray(const char *str,
>>> Why not to destroy the use of vshStringToArray, and convert to
>> vshStringToArray is converting double commas (",,") as escape sequence
>> for a comma. virStringSplit doesn't do this. We would regress in virsh
>> option parsing if we'd convert it to virStringSplit.
> 
> Integrating the escaping into virStringSplit with a flag will work,
> but I'm not against if you keep using it, since the mainly purpose
> of these patches is to fix the bug.

It won't be that easy for virStringSplit. virStringSplit is splitting
the string on a delimiter _string_ thus it won't be easy to teach it
escape sequences. The double comma escape is a virsh thing, thus I
didn't bother changing that globally (and risk potential regressions in
code that is using virStringSplit).

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]