From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUfgo-00064j-MX for qemu-devel@nongnu.org; Wed, 26 Aug 2015 14:44:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUfgl-0004BD-Gb for qemu-devel@nongnu.org; Wed, 26 Aug 2015 14:44:50 -0400 Received: from mx2.parallels.com ([199.115.105.18]:50072) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUfgl-0004AJ-Ap for qemu-devel@nongnu.org; Wed, 26 Aug 2015 14:44:47 -0400 References: <1440583525-21632-1-git-send-email-marcandre.lureau@redhat.com> <1440583525-21632-4-git-send-email-marcandre.lureau@redhat.com> <55DDFD80.8000202@parallels.com> <55DE0410.3040800@parallels.com> From: "Denis V. Lunev" Message-ID: <55DE0914.3070801@parallels.com> Date: Wed, 26 Aug 2015 21:44:36 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v3 03/12] qga: move string split in separate function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= Cc: QEMU , Michael Roth On 08/26/2015 09:30 PM, Marc-André Lureau wrote: > Hi > > On Wed, Aug 26, 2015 at 8:23 PM, Denis V. Lunev 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() >