qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 03/12] qga: move string split in separate fun


From: Denis V. Lunev
Subject: Re: [Qemu-devel] [PATCH v3 03/12] qga: move string split in separate function
Date: Wed, 26 Aug 2015 21:23:12 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

On 08/26/2015 09:07 PM, Marc-André Lureau wrote:
Hi

On Wed, Aug 26, 2015 at 7:55 PM, Denis V. Lunev <address@hidden> wrote:
it would be much better to declare this helper as "split_list(const gchar
*str, ...
and make temporary copy of parameter inside. Without this the function
as NASTY side-effect and trashes the string passed in.
Also it is rather reinvents strtok wheel.
Yep, notice I didn't change the code, merely moved it.
I think that this side effect is visible if the code remains in place
and becomes invisible since you move it to the function.
This could create problem if somebody will reuse this call.


you can also use g_strsplit at your convenience, but may be this is overkill
But it doesn't return a glist. So while I agree with you in general,
that wasn't my goal to change this code, but just to be able to reuse
it.

thanks




reply via email to

[Prev in Thread] Current Thread [Next in Thread]