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

On Wed, Aug 26, 2015 at 7:55 PM, Denis V. Lunev <den-li...@parallels.com> 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