mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
block: Simplify setting numeric options
Don't convert numbers to strings for use with qemu_opt_set(), simply use qemu_opt_set_number() instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
dc523cd348
commit
a8b18f8fd2
2 changed files with 7 additions and 10 deletions
|
@ -180,7 +180,6 @@ QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
|
|||
const char *optstr)
|
||||
{
|
||||
QemuOpts *opts;
|
||||
char buf[32];
|
||||
|
||||
opts = drive_def(optstr);
|
||||
if (!opts) {
|
||||
|
@ -190,8 +189,7 @@ QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
|
|||
qemu_opt_set(opts, "if", if_name[type], &error_abort);
|
||||
}
|
||||
if (index >= 0) {
|
||||
snprintf(buf, sizeof(buf), "%d", index);
|
||||
qemu_opt_set(opts, "index", buf, &error_abort);
|
||||
qemu_opt_set_number(opts, "index", index, &error_abort);
|
||||
}
|
||||
if (file)
|
||||
qemu_opt_set(opts, "file", file, &error_abort);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue