On Fri, Oct 26, 2012 at 5:02 PM, Stefan Hajnoczi <[email protected]> wrote: > On Thu, Oct 25, 2012 at 08:57:24PM +0800, Dong Xu Wang wrote: >> diff --git a/qemu-option.c b/qemu-option.c >> index d7d5ea9..eeb2c9c 100644 >> --- a/qemu-option.c >> +++ b/qemu-option.c >> @@ -695,6 +695,30 @@ int qemu_opt_set_bool(QemuOpts *opts, const char *name, >> bool val) >> return 0; >> } >> >> +int qemu_opt_set_number(QemuOpts *opts, const char *name, int64_t val) >> +{ >> + char buffer[1024]; >> + QemuOpt *opt; >> + const QemuOptDesc *desc = opts->list->desc; >> + >> + snprintf(buffer, sizeof(buffer), "%" PRId64, val); > > g_strdup_printf() is a nice replacement for fixed-size buffer + > snprintf() + g_strdup(): > > http://developer.gnome.org/glib/2.28/glib-String-Utility-Functions.html#g-strdup-printf > Okay.
> Stefan >
