aboutsummaryrefslogtreecommitdiff
path: root/net/announce.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2022-11-04 17:07:00 +0100
committerMarkus Armbruster <armbru@redhat.com>2022-12-14 20:04:47 +0100
commit7480874a69b17000cd10a2f97dbe51580ec44a96 (patch)
tree5a2a339dd854d791b55625c1eeecc4b88e627192 /net/announce.c
parent9492718b7c00c0a16e2ce834752b8c200e3217d1 (diff)
qapi net: Elide redundant has_FOO in generated C
The has_FOO for pointer-valued FOO are redundant, except for arrays. They are also a nuisance to work with. Recent commit "qapi: Start to elide redundant has_FOO in generated C" provided the means to elide them step by step. This is the step for qapi/net.json. Said commit explains the transformation in more detail. The invariant violations mentioned there do not occur here. Cc: Jason Wang <jasowang@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20221104160712.3005652-19-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> [Fixes for MacOS squashed in]
Diffstat (limited to 'net/announce.c')
-rw-r--r--net/announce.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/announce.c b/net/announce.c
index 62c60192a3..9e99044422 100644
--- a/net/announce.c
+++ b/net/announce.c
@@ -46,7 +46,7 @@ void qemu_announce_timer_del(AnnounceTimer *timer, bool free_named)
}
qapi_free_strList(timer->params.interfaces);
timer->params.interfaces = NULL;
- if (free_named && timer->params.has_id) {
+ if (free_named && timer->params.id) {
AnnounceTimer *list_timer;
/*
* Sanity check: There should only be one timer on the list with
@@ -157,7 +157,7 @@ static void qemu_announce_self_iter(NICState *nic, void *opaque)
skip = false;
}
- trace_qemu_announce_self_iter(timer->params.has_id ? timer->params.id : "_",
+ trace_qemu_announce_self_iter(timer->params.id ?: "_",
nic->ncs->name,
qemu_ether_ntoa(&nic->conf->macaddr), skip);
@@ -199,9 +199,9 @@ void qemu_announce_self(AnnounceTimer *timer, AnnounceParameters *params)
void qmp_announce_self(AnnounceParameters *params, Error **errp)
{
AnnounceTimer *named_timer;
- if (!params->has_id) {
+
+ if (!params->id) {
params->id = g_strdup("");
- params->has_id = true;
}
named_timer = g_datalist_get_data(&named_timers, params->id);