From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUfM3-0006dm-Lb for qemu-devel@nongnu.org; Wed, 26 Aug 2015 14:23:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUfM0-0006SS-8h for qemu-devel@nongnu.org; Wed, 26 Aug 2015 14:23:23 -0400 Received: from mx2.parallels.com ([199.115.105.18]:49012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUfM0-0006Rn-34 for qemu-devel@nongnu.org; Wed, 26 Aug 2015 14:23:20 -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> From: "Denis V. Lunev" Message-ID: <55DE0410.3040800@parallels.com> Date: Wed, 26 Aug 2015 21:23:12 +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:07 PM, Marc-André Lureau wrote: > Hi > > On Wed, Aug 26, 2015 at 7:55 PM, Denis V. Lunev 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 >