slirp: remove Monitor dependency, return a string for info

There is nothing performance-sensitive in returning an allocated
string for info, and handling the monitor_printf() on the caller side.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
Marc-André Lureau 2018-11-10 17:45:43 +04:00 committed by Samuel Thibault
parent 634d03487b
commit b7f43bf2f6
3 changed files with 18 additions and 14 deletions

View file

@ -828,10 +828,11 @@ void hmp_info_usernet(Monitor *mon, const QDict *qdict)
QTAILQ_FOREACH(s, &slirp_stacks, entry) {
int id;
bool got_hub_id = net_hub_id_for_client(&s->nc, &id) == 0;
monitor_printf(mon, "Hub %d (%s):\n",
char *info = slirp_connection_info(s->slirp);
monitor_printf(mon, "Hub %d (%s):\n%s",
got_hub_id ? id : -1,
s->nc.name);
slirp_connection_info(s->slirp, mon);
s->nc.name, info);
g_free(info);
}
}