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:44:36 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

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

On Wed, Aug 26, 2015 at 8:23 PM, Denis V. Lunev <address@hidden> wrote:
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.
what about replacing it with:

static GList *split_list(gchar *str, const gchar *delim)
{
     GList *list = NULL;
     int i;
     gchar **strv;

     strv = g_strsplit(str, delim, -1);
     for (i = 0; strv[i]; i++) {
         list = g_list_prepend(list, strv[i]);
     }
     g_free(strv);

     return list;
}

would that work for you?
yep! and you could declare it with 'const gchar *str'

the list must then be g_list_free_full()





reply via email to

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