Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-01-28' into staging

QAPI patches patches for 2021-01-28

# gpg: Signature made Thu 28 Jan 2021 07:10:21 GMT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2021-01-28:
  qapi: More complex uses of QAPI_LIST_APPEND
  qapi: Use QAPI_LIST_APPEND in trivial cases
  qapi: Introduce QAPI_LIST_APPEND
  qapi: A couple more QAPI_LIST_PREPEND() stragglers
  net: Clarify early exit condition

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell
2021-01-28 22:43:18 +00:00
31 changed files with 267 additions and 551 deletions

View File

@@ -354,11 +354,11 @@ static const char *wan_compression_names[] = {
static SpiceChannelList *qmp_query_spice_channels(void)
{
SpiceChannelList *cur_item = NULL, *head = NULL;
SpiceChannelList *head = NULL, **tail = &head;
ChannelList *item;
QTAILQ_FOREACH(item, &channel_list, link) {
SpiceChannelList *chan;
SpiceChannel *chan;
char host[NI_MAXHOST], port[NI_MAXSERV];
struct sockaddr *paddr;
socklen_t plen;
@@ -366,29 +366,22 @@ static SpiceChannelList *qmp_query_spice_channels(void)
assert(item->info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT);
chan = g_malloc0(sizeof(*chan));
chan->value = g_malloc0(sizeof(*chan->value));
paddr = (struct sockaddr *)&item->info->paddr_ext;
plen = item->info->plen_ext;
getnameinfo(paddr, plen,
host, sizeof(host), port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV);
chan->value->host = g_strdup(host);
chan->value->port = g_strdup(port);
chan->value->family = inet_netfamily(paddr->sa_family);
chan->host = g_strdup(host);
chan->port = g_strdup(port);
chan->family = inet_netfamily(paddr->sa_family);
chan->value->connection_id = item->info->connection_id;
chan->value->channel_type = item->info->type;
chan->value->channel_id = item->info->id;
chan->value->tls = item->info->flags & SPICE_CHANNEL_EVENT_FLAG_TLS;
chan->connection_id = item->info->connection_id;
chan->channel_type = item->info->type;
chan->channel_id = item->info->id;
chan->tls = item->info->flags & SPICE_CHANNEL_EVENT_FLAG_TLS;
/* XXX: waiting for the qapi to support GSList */
if (!cur_item) {
head = cur_item = chan;
} else {
cur_item->next = chan;
cur_item = chan;
}
QAPI_LIST_APPEND(tail, chan);
}
return head;