aboutsummaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-01-24 13:19:41 +0100
committerMarkus Armbruster <armbru@redhat.com>2023-02-04 07:56:54 +0100
commitdd00d7fa653de2768d036f88b77ea936b8f0571e (patch)
treec28ceb163728bd3e5ca522b6c63c89c74ab0da66 /monitor
parent7ef88b53343efc932dfecfa01426e179dd042dd4 (diff)
monitor: Move monitor_putc() next to monitor_puts & external linkage
monitor_putc() will soon be used from more than one .c file. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230124121946.1139465-28-armbru@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r--monitor/misc.c27
-rw-r--r--monitor/monitor.c27
2 files changed, 27 insertions, 27 deletions
diff --git a/monitor/misc.c b/monitor/misc.c
index c531d95b5b..7a0ba35923 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -304,33 +304,6 @@ static void hmp_gdbserver(Monitor *mon, const QDict *qdict)
}
}
-static void monitor_printc(Monitor *mon, int c)
-{
- monitor_printf(mon, "'");
- switch(c) {
- case '\'':
- monitor_printf(mon, "\\'");
- break;
- case '\\':
- monitor_printf(mon, "\\\\");
- break;
- case '\n':
- monitor_printf(mon, "\\n");
- break;
- case '\r':
- monitor_printf(mon, "\\r");
- break;
- default:
- if (c >= 32 && c <= 126) {
- monitor_printf(mon, "%c", c);
- } else {
- monitor_printf(mon, "\\x%02x", c);
- }
- break;
- }
- monitor_printf(mon, "'");
-}
-
static void memory_dump(Monitor *mon, int count, int format, int wsize,
hwaddr addr, int is_physical)
{
diff --git a/monitor/monitor.c b/monitor/monitor.c
index 7ed7bd5342..e1d5002adf 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -260,6 +260,33 @@ int monitor_printf(Monitor *mon, const char *fmt, ...)
return ret;
}
+void monitor_printc(Monitor *mon, int c)
+{
+ monitor_printf(mon, "'");
+ switch(c) {
+ case '\'':
+ monitor_printf(mon, "\\'");
+ break;
+ case '\\':
+ monitor_printf(mon, "\\\\");
+ break;
+ case '\n':
+ monitor_printf(mon, "\\n");
+ break;
+ case '\r':
+ monitor_printf(mon, "\\r");
+ break;
+ default:
+ if (c >= 32 && c <= 126) {
+ monitor_printf(mon, "%c", c);
+ } else {
+ monitor_printf(mon, "\\x%02x", c);
+ }
+ break;
+ }
+ monitor_printf(mon, "'");
+}
+
/*
* Print to current monitor if we have one, else to stderr.
*/