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

Re: [libvirt] [PATCHv2 2/3] qemu: simplify list cleanup



On 28.08.2013 23:01, Eric Blake wrote:
> No need to open code now that we have a nice function.
> 
> Interestingly, our virStringFreeList function is typed correctly
> (a malloc'd list of malloc'd strings is NOT const, whether at the
> point where it is created, or at the point where it is cleand up),
> so using it with a 'const char **' argument would require a cast
> to keep the compiler.  I chose instead to remove const from code
> even where we don't modify the argument, just to avoid the need
> to cast.
> 
> * src/qemu/qemu_command.h (qemuParseCommandLine): Drop declaration.
> * src/qemu/qemu_command.c (qemuParseProcFileStrings)
> (qemuStringToArgvEnv): Don't force malloc'd result to be const.
> (qemuParseCommandLinePid, qemuParseCommandLineString): Simplify
> cleanup.
> (qemuParseCommandLine, qemuFindEnv): Drop const-correctness to
> avoid the need to cast in callers.
> 
> Signed-off-by: Eric Blake <eblake redhat com>
> ---
> 
> v2: fix compilation, and extend the cleanup
> 
>  src/qemu/qemu_command.c | 72 +++++++++++++++++++------------------------------
>  src/qemu/qemu_command.h |  7 -----
>  2 files changed, 27 insertions(+), 52 deletions(-)

ACK

Michal


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