aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-02-13 15:50:43 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-02-26 14:51:46 +0100
commita8b18f8fd2d9f0df33c3739e76fedfd9355dfa8b (patch)
tree5897e1319aa3f3d4433c0e13065a6c8a8ab6024f /blockdev.c
parentdc523cd348c47372faa7271c9aab2030f94c290d (diff)
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>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/blockdev.c b/blockdev.c
index 5aa23b56b2..b9c1c0cc1a 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -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);