[PATCH v2 07/27] domain_conf: Fix virDomainMemoryModel type
Peter Krempa
pkrempa at redhat.com
Fri Dec 4 07:21:34 UTC 2020
On Thu, Dec 03, 2020 at 13:36:10 +0100, Michal Privoznik wrote:
> The virDomainMemoryModel structure has a @type member which is
> really type of virDomainMemoryModel but we store it as int
> because the virDomainMemoryModelTypeFromString() call stores its
> retval right into it. Then, to have compiler do compile time
> check for us, every switch() typecasts the @type. This is
> needlessly verbose because the parses already has @val - a
> variable to store temporary values. Switch @type in the struct to
I actually wanted to ramble about reuse of @val, but it's there multiple
times ...
> virDomainMemoryModel and drop all typecasts.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> src/conf/domain_conf.c | 9 +++++----
> src/conf/domain_conf.h | 2 +-
> src/qemu/qemu_command.c | 2 +-
> src/qemu/qemu_domain.c | 4 ++--
> src/security/security_apparmor.c | 2 +-
> src/security/security_dac.c | 4 ++--
> src/security/security_selinux.c | 4 ++--
> 7 files changed, 14 insertions(+), 13 deletions(-)
Reviewed-by: Peter Krempa <pkrempa at redhat.com>
More information about the libvir-list
mailing list