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: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH v3 03/12] qga: move string split in separate function
Date: Wed, 26 Aug 2015 20:30:53 +0200

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?

the list must then be g_list_free_full()

-- 
Marc-André Lureau



reply via email to

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