[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/12] opts: do not print separator before first ite
From: |
Kővágó, Zoltán |
Subject: |
[Qemu-devel] [PATCH 09/12] opts: do not print separator before first item in qemu_opts_print |
Date: |
Fri, 12 Jun 2015 14:33:10 +0200 |
This allows to print options in a format that the user would actually write it
on the command line (foo=bar,baz=asd,etc=def), without prepending a spurious
comma at the beginning of the list.
Only block.c depended on the old behavior, but it was also updated.
Signed-off-by: Kővágó, Zoltán <address@hidden>
---
block.c | 2 +-
util/qemu-option.c | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index 2b9ceae..ef335bc 100644
--- a/block.c
+++ b/block.c
@@ -3644,7 +3644,7 @@ void bdrv_img_create(const char *filename, const char
*fmt,
}
if (!quiet) {
- printf("Formatting '%s', fmt=%s", filename, fmt);
+ printf("Formatting '%s', fmt=%s ", filename, fmt);
qemu_opts_print(opts, " ");
puts("");
}
diff --git a/util/qemu-option.c b/util/qemu-option.c
index 840f5f7..b347d92 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -728,14 +728,16 @@ void qemu_opts_del(QemuOpts *opts)
g_free(opts);
}
-void qemu_opts_print(QemuOpts *opts, const char *sep)
+void qemu_opts_print(QemuOpts *opts, const char *d_sep)
{
QemuOpt *opt;
QemuOptDesc *desc = opts->list->desc;
+ const char *sep = "";
if (desc[0].name == NULL) {
QTAILQ_FOREACH(opt, &opts->head, next) {
printf("%s%s=\"%s\"", sep, opt->name, opt->str);
+ sep = d_sep;
}
return;
}
@@ -755,6 +757,7 @@ void qemu_opts_print(QemuOpts *opts, const char *sep)
} else {
printf("%s%s=%s", sep, desc->name, value);
}
+ sep = d_sep;
}
}
--
2.4.2
- [Qemu-devel] [PATCH 00/12] -audiodev option, Kővágó, Zoltán, 2015/06/12
- [Qemu-devel] [PATCH 01/12] audio: remove LOG_TO_MONITOR along with default_mon, Kővágó, Zoltán, 2015/06/12
- [Qemu-devel] [PATCH 02/12] audio: remove plive, Kővágó, Zoltán, 2015/06/12
- [Qemu-devel] [PATCH 03/12] dsoundaudio: remove *_retries kludges, Kővágó, Zoltán, 2015/06/12
- [Qemu-devel] [PATCH 04/12] dsoundaudio: remove primary buffer, Kővágó, Zoltán, 2015/06/12
- [Qemu-devel] [PATCH 06/12] ossaudio: use trace events instead of debug config flag, Kővágó, Zoltán, 2015/06/12
- [Qemu-devel] [PATCH 05/12] alsaaudio: use trace events instead of verbose, Kővágó, Zoltán, 2015/06/12
- [Qemu-devel] [PATCH 09/12] opts: do not print separator before first item in qemu_opts_print,
Kővágó, Zoltán <=
- [Qemu-devel] [PATCH 07/12] qapi: qapi for audio backends, Kővágó, Zoltán, 2015/06/12
- [Qemu-devel] [PATCH 10/12] qapi: AllocVisitor, Kővágó, Zoltán, 2015/06/12
- [Qemu-devel] [PATCH 08/12] qapi: support nested structs in OptsVisitor, Kővágó, Zoltán, 2015/06/12
- [Qemu-devel] [PATCH 11/12] audio: use qapi AudioFormat instead of audfmt_e, Kővágó, Zoltán, 2015/06/12
- [Qemu-devel] [PATCH 12/12] audio: -audiodev command line option, Kővágó, Zoltán, 2015/06/12
- Re: [Qemu-devel] [PATCH 00/12] -audiodev option, Gerd Hoffmann, 2015/06/15