aboutsummaryrefslogtreecommitdiff
path: root/monitor/hmp-cmds.c
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2022-09-29 12:42:12 +0100
committerAlex Bennée <alex.bennee@linaro.org>2022-10-06 11:53:40 +0100
commitbf0c50d4aa851e78c91096f510303831a2aadaeb (patch)
treec9a32bf2cb27868452159bd243d0e28c57b247da /monitor/hmp-cmds.c
parent3cc70a9994bf0967c7a2bda539ed43926fb4c2cb (diff)
downloadqemu-bf0c50d4aa851e78c91096f510303831a2aadaeb.zip
qemu-bf0c50d4aa851e78c91096f510303831a2aadaeb.tar.gz
qemu-bf0c50d4aa851e78c91096f510303831a2aadaeb.tar.bz2
monitor: expose monitor_puts to rest of code
This helps us construct strings elsewhere before echoing to the monitor. It avoids having to jump through hoops like: monitor_printf(mon, "%s", s->str); It will be useful in following patches but for now convert all existing plain "%s" printfs to use the _puts api. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220929114231.583801-33-alex.bennee@linaro.org>
Diffstat (limited to 'monitor/hmp-cmds.c')
-rw-r--r--monitor/hmp-cmds.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index c6cd6f9..f90eea8 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -730,7 +730,7 @@ static void hmp_info_pci_device(Monitor *mon, const PciDeviceInfo *dev)
monitor_printf(mon, " ");
if (dev->class_info->has_desc) {
- monitor_printf(mon, "%s", dev->class_info->desc);
+ monitor_puts(mon, dev->class_info->desc);
} else {
monitor_printf(mon, "Class %04" PRId64, dev->class_info->q_class);
}
@@ -2258,12 +2258,12 @@ static void print_stats_schema_value(Monitor *mon, StatsSchemaValue *value)
if (unit && value->base == 10 &&
value->exponent >= -18 && value->exponent <= 18 &&
value->exponent % 3 == 0) {
- monitor_printf(mon, "%s", si_prefix(value->exponent));
+ monitor_puts(mon, si_prefix(value->exponent));
} else if (unit && value->base == 2 &&
value->exponent >= 0 && value->exponent <= 60 &&
value->exponent % 10 == 0) {
- monitor_printf(mon, "%s", iec_binary_prefix(value->exponent));
+ monitor_puts(mon, iec_binary_prefix(value->exponent));
} else if (value->exponent) {
/* Use exponential notation and write the unit's English name */
monitor_printf(mon, "* %d^%d%s",
@@ -2273,7 +2273,7 @@ static void print_stats_schema_value(Monitor *mon, StatsSchemaValue *value)
}
if (value->has_unit) {
- monitor_printf(mon, "%s", unit ? unit : StatsUnit_str(value->unit));
+ monitor_puts(mon, unit ? unit : StatsUnit_str(value->unit));
}
/* Print bucket size for linear histograms */