mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33: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
13
vl.c
13
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue