mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
qapi misc: 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/misc.json. Said commit explains the transformation in more detail. The invariant violations mentioned there do not occur here. Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20221104160712.3005652-18-armbru@redhat.com>
This commit is contained in:
parent
720a252c26
commit
9492718b7c
7 changed files with 14 additions and 36 deletions
|
@ -1132,7 +1132,7 @@ void monitor_fdsets_cleanup(void)
|
|||
}
|
||||
}
|
||||
|
||||
AddfdInfo *qmp_add_fd(bool has_fdset_id, int64_t fdset_id, bool has_opaque,
|
||||
AddfdInfo *qmp_add_fd(bool has_fdset_id, int64_t fdset_id,
|
||||
const char *opaque, Error **errp)
|
||||
{
|
||||
int fd;
|
||||
|
@ -1145,8 +1145,7 @@ AddfdInfo *qmp_add_fd(bool has_fdset_id, int64_t fdset_id, bool has_opaque,
|
|||
goto error;
|
||||
}
|
||||
|
||||
fdinfo = monitor_fdset_add_fd(fd, has_fdset_id, fdset_id,
|
||||
has_opaque, opaque, errp);
|
||||
fdinfo = monitor_fdset_add_fd(fd, has_fdset_id, fdset_id, opaque, errp);
|
||||
if (fdinfo) {
|
||||
return fdinfo;
|
||||
}
|
||||
|
@ -1214,12 +1213,7 @@ FdsetInfoList *qmp_query_fdsets(Error **errp)
|
|||
|
||||
fdsetfd_info = g_malloc0(sizeof(*fdsetfd_info));
|
||||
fdsetfd_info->fd = mon_fdset_fd->fd;
|
||||
if (mon_fdset_fd->opaque) {
|
||||
fdsetfd_info->has_opaque = true;
|
||||
fdsetfd_info->opaque = g_strdup(mon_fdset_fd->opaque);
|
||||
} else {
|
||||
fdsetfd_info->has_opaque = false;
|
||||
}
|
||||
fdsetfd_info->opaque = g_strdup(mon_fdset_fd->opaque);
|
||||
|
||||
QAPI_LIST_PREPEND(fdset_info->fds, fdsetfd_info);
|
||||
}
|
||||
|
@ -1231,8 +1225,7 @@ FdsetInfoList *qmp_query_fdsets(Error **errp)
|
|||
}
|
||||
|
||||
AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
|
||||
bool has_opaque, const char *opaque,
|
||||
Error **errp)
|
||||
const char *opaque, Error **errp)
|
||||
{
|
||||
MonFdset *mon_fdset = NULL;
|
||||
MonFdsetFd *mon_fdset_fd;
|
||||
|
@ -1300,9 +1293,7 @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
|
|||
mon_fdset_fd = g_malloc0(sizeof(*mon_fdset_fd));
|
||||
mon_fdset_fd->fd = fd;
|
||||
mon_fdset_fd->removed = false;
|
||||
if (has_opaque) {
|
||||
mon_fdset_fd->opaque = g_strdup(opaque);
|
||||
}
|
||||
mon_fdset_fd->opaque = g_strdup(opaque);
|
||||
QLIST_INSERT_HEAD(&mon_fdset->fds, mon_fdset_fd, next);
|
||||
|
||||
fdinfo = g_malloc0(sizeof(*fdinfo));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue