rpc: use struct zero initializer instead of memset

This is a more concise approach and guarantees there is
no time window where the struct is uninitialized.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2022-12-22 10:42:20 -05:00
parent 8ed7ef5d1a
commit 1c656836e3
1 changed files with 1 additions and 6 deletions

View File

@ -1534,7 +1534,7 @@ elsif ($mode eq "client") {
if ($rettype eq "void") {
$call_ret = "NULL";
} else {
push(@vars_list, "$rettype ret");
push(@vars_list, "$rettype ret = {0}");
foreach my $ret_member (@{$call->{ret_members}}) {
if ($multi_ret) {
@ -1891,11 +1891,6 @@ elsif ($mode eq "client") {
print "\n";
}
if ($rettype ne "void") {
print "\n";
print " memset(&ret, 0, sizeof(ret));\n";
}
my $callflags = "0";
if ($structprefix eq "qemu") {
$callflags = "REMOTE_CALL_QEMU";