[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/1 v4] Allow machines to configure the QEMU_VER

From: Crístian Viana
Subject: Re: [Qemu-devel] [PATCH 1/1 v4] Allow machines to configure the QEMU_VERSION that's exposed via hardware
Date: Wed, 23 May 2012 17:06:37 -0300
User-agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

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,

reply via email to

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