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.