aboutsummaryrefslogtreecommitdiff
path: root/vl.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 /vl.c
parentdc523cd348c47372faa7271c9aab2030f94c290d (diff)
downloadqemu-a8b18f8fd2d9f0df33c3739e76fedfd9355dfa8b.zip
qemu-a8b18f8fd2d9f0df33c3739e76fedfd9355dfa8b.tar.gz
qemu-a8b18f8fd2d9f0df33c3739e76fedfd9355dfa8b.tar.bz2
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 'vl.c')
-rw-r--r--vl.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/vl.c b/vl.c
index 66b0ad8..e2c1950 100644
--- a/vl.c
+++ b/vl.c
@@ -2971,13 +2971,12 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
if (hda_opts != NULL) {
- char num[16];
- snprintf(num, sizeof(num), "%d", cyls);
- qemu_opt_set(hda_opts, "cyls", num, &error_abort);
- snprintf(num, sizeof(num), "%d", heads);
- qemu_opt_set(hda_opts, "heads", num, &error_abort);
- snprintf(num, sizeof(num), "%d", secs);
- qemu_opt_set(hda_opts, "secs", num, &error_abort);
+ qemu_opt_set_number(hda_opts, "cyls", cyls,
+ &error_abort);
+ qemu_opt_set_number(hda_opts, "heads", heads,
+ &error_abort);
+ qemu_opt_set_number(hda_opts, "secs", secs,
+ &error_abort);
if (translation == BIOS_ATA_TRANSLATION_LARGE) {
qemu_opt_set(hda_opts, "trans", "large",
&error_abort);