From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Np0Wr-0006pi-NZ for qemu-devel@nongnu.org; Tue, 09 Mar 2010 09:35:27 -0500 Received: from [199.232.76.173] (port=44128 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Np0Wp-0006oB-Pr for qemu-devel@nongnu.org; Tue, 09 Mar 2010 09:35:23 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Np0Wn-0007xn-75 for qemu-devel@nongnu.org; Tue, 09 Mar 2010 09:35:23 -0500 Received: from mx20.gnu.org ([199.232.41.8]:7198) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Np0Wm-0007wn-Hq for qemu-devel@nongnu.org; Tue, 09 Mar 2010 09:35:20 -0500 Received: from e28smtp09.in.ibm.com ([122.248.162.9]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Np0Wi-0002o7-3L for qemu-devel@nongnu.org; Tue, 09 Mar 2010 09:35:16 -0500 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by e28smtp09.in.ibm.com (8.14.3/8.13.1) with ESMTP id o29DrJvC009476 for ; Tue, 9 Mar 2010 19:23:19 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o29EZ4bH1593578 for ; Tue, 9 Mar 2010 20:05:05 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o29EZ4SS016973 for ; Wed, 10 Mar 2010 01:35:04 +1100 From: "Aneesh Kumar K. V" Subject: Re: [Qemu-devel] [PATCH 04/17] virtio-9p: Implement P9_TSTAT In-Reply-To: <201003091230.08628.paul@codesourcery.com> References: <1267642874-15001-1-git-send-email-aliguori@us.ibm.com> <87vddcjhpv.fsf@linux.vnet.ibm.com> <4B95AD93.1070502@linux.vnet.ibm.com> <201003091230.08628.paul@codesourcery.com> Date: Tue, 09 Mar 2010 20:05:02 +0530 Message-ID: <878wa136nd.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook , qemu-devel@nongnu.org Cc: Anthony Liguori , jvrao , Gautham R Shenoy On Tue, 9 Mar 2010 12:30:08 +0000, Paul Brook wrote: > > Is there any reason (other than being coding style) in using qemu_free() > > instead of free()? As per qem-malloc.c qemu_free() is nothing but free(). > > The whole point of qemu_{malloc,free} is to isolate code from the system > implementation of malloc/free. It's entirely possible that future versions of > qemu_malloc will use a different memory allocation strategy. > > > The reason I am asking is.. tracking string allocs become tricky > > if some of them were defined using qemu_alloc() and others are allocated > > through sprintf(). > > sprintf does not allocate memory. > If you mean strdup, then you shouldn't be using that (use qemu_strdup). we have code that does static void v9fs_string_sprintf(V9fsString *str, const char *fmt, ...) { va_list ap; int err; v9fs_string_free(str); va_start(ap, fmt); err = vasprintf(&str->data, fmt, ap); BUG_ON(err == -1); va_end(ap); str->size = err; } I guess we should not be using vasprint. What alternatives are available today ? -aneesh