This is a more concise approach and guarantees there is
no time window where the struct is uninitialized.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/rpc/gendispatch.pl | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 63d2411474..e9dc8e27d7 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -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";
--
2.38.1