Skip to content

Commit

Permalink
block: Don't add trailing space in "Formating..." message
Browse files Browse the repository at this point in the history
Change the message printing code to output a separator for each option
string before it instead of after, then we don't one more extra ' ' in
the end.

To update qemu-iotests output files, most of the times one would just
copy the *.out.bad to *.out. With this change we will not have the
space disliked by checkpatch.pl.

Signed-off-by: Fam Zheng <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Message-id: [email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
  • Loading branch information
Fam Zheng authored and stefanhaRH committed Dec 12, 2014
1 parent 7486458 commit 43c5d8f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions block.c
Original file line number Diff line number Diff line change
Expand Up @@ -5668,8 +5668,8 @@ void bdrv_img_create(const char *filename, const char *fmt,
}

if (!quiet) {
printf("Formatting '%s', fmt=%s ", filename, fmt);
qemu_opts_print(opts);
printf("Formatting '%s', fmt=%s", filename, fmt);
qemu_opts_print(opts, " ");
puts("");
}

Expand Down
2 changes: 1 addition & 1 deletion include/qemu/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ QDict *qemu_opts_to_qdict(QemuOpts *opts, QDict *qdict);
void qemu_opts_absorb_qdict(QemuOpts *opts, QDict *qdict, Error **errp);

typedef int (*qemu_opts_loopfunc)(QemuOpts *opts, void *opaque);
void qemu_opts_print(QemuOpts *opts);
void qemu_opts_print(QemuOpts *opts, const char *sep);
int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque,
int abort_on_failure);
void qemu_opts_print_help(QemuOptsList *list);
Expand Down
10 changes: 5 additions & 5 deletions util/qemu-option.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,14 @@ void qemu_opts_del(QemuOpts *opts)
g_free(opts);
}

void qemu_opts_print(QemuOpts *opts)
void qemu_opts_print(QemuOpts *opts, const char *sep)
{
QemuOpt *opt;
QemuOptDesc *desc = opts->list->desc;

if (desc[0].name == NULL) {
QTAILQ_FOREACH(opt, &opts->head, next) {
printf("%s=\"%s\" ", opt->name, opt->str);
printf("%s%s=\"%s\"", sep, opt->name, opt->str);
}
return;
}
Expand All @@ -757,12 +757,12 @@ void qemu_opts_print(QemuOpts *opts)
continue;
}
if (desc->type == QEMU_OPT_STRING) {
printf("%s='%s' ", desc->name, value);
printf("%s%s='%s'", sep, desc->name, value);
} else if ((desc->type == QEMU_OPT_SIZE ||
desc->type == QEMU_OPT_NUMBER) && opt) {
printf("%s=%" PRId64 " ", desc->name, opt->value.uint);
printf("%s%s=%" PRId64, sep, desc->name, opt->value.uint);
} else {
printf("%s=%s ", desc->name, value);
printf("%s%s=%s", sep, desc->name, value);
}
}
}
Expand Down

0 comments on commit 43c5d8f

Please sign in to comment.