qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Crístian Viana" <vianac@linux.vnet.ibm.com>
To: Eric Blake <eblake@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	aliguori@us.ibm.com, qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <4FBD434D.9030706@linux.vnet.ibm.com> (raw)
In-Reply-To: <4FBD0C3C.1000505@redhat.com>

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.

  reply	other threads:[~2012-05-23 20:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-22 21:10 [Qemu-devel] [PATCH 1/1 v4] Allow machines to configure the QEMU_VERSION that's exposed via hardware Crístian Viana
2012-05-22 21:38 ` Peter Maydell
2012-05-23 16:08   ` Crístian Viana
2012-05-23 16:11     ` Eric Blake
2012-05-23 20:06       ` Crístian Viana [this message]
2012-05-23 20:54         ` Peter Maydell
2012-05-24 19:54           ` Crístian Viana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FBD434D.9030706@linux.vnet.ibm.com \
    --to=vianac@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=eblake@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).