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>
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) {
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";