From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXHpb-0004eZ-L9 for qemu-devel@nongnu.org; Wed, 23 May 2012 16:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXHpZ-0008KV-3f for qemu-devel@nongnu.org; Wed, 23 May 2012 16:06:51 -0400 Received: from e24smtp03.br.ibm.com ([32.104.18.24]:53895) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXHpY-0008Ij-Oe for qemu-devel@nongnu.org; Wed, 23 May 2012 16:06:49 -0400 Received: from /spool/local by e24smtp03.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 23 May 2012 17:06:42 -0300 Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.13.184.26]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id E61253520051 for ; Wed, 23 May 2012 17:06:33 -0300 (BRT) Received: from d24av04.br.ibm.com (d24av04.br.ibm.com [9.8.31.97]) by d24relay02.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q4NK693P27459594 for ; Wed, 23 May 2012 17:06:09 -0300 Received: from d24av04.br.ibm.com (loopback [127.0.0.1]) by d24av04.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q4NI6PLD029345 for ; Wed, 23 May 2012 15:06:25 -0300 Message-ID: <4FBD434D.9030706@linux.vnet.ibm.com> Date: Wed, 23 May 2012 17:06:37 -0300 From: =?UTF-8?B?Q3LDrXN0aWFuIFZpYW5h?= MIME-Version: 1.0 References: <1337721011-20842-1-git-send-email-vianac@linux.vnet.ibm.com> <4FBD0B85.4090605@linux.vnet.ibm.com> <4FBD0C3C.1000505@redhat.com> In-Reply-To: <4FBD0C3C.1000505@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 1/1 v4] Allow machines to configure the QEMU_VERSION that's exposed via hardware List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Peter Maydell , aliguori@us.ibm.com, qemu-devel@nongnu.org On 23-05-2012 13:11, Eric Blake wrote: > pstrcat is more efficient than snprintf() - the former is dedicated to a > single task, while the latter has to parse a format string and decode > that it is doing a single %s expansion. In other words, just because > *printf can do string concatenation doesn't make it the best tool for > the job. This would be the new code: snprintf((void *) w, 12, "QEMU %s", qemu_get_version()); /* char version[12] */ I'm not sure of what value the pointer contains at that moment, concatenating doesn't seem safe to me. What if w already contains a string? The result won't be the same. I don't understand the Nokia code, so I prefer to leave it as it was before (with snprintf). Best regards, Crístian.