[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] remote generator: Handle struct returning functions better (part 2)



Commit 64000eabedf2 is part 1, that only covered the daemon side by
accident. Part 2 covers the client side too.
---
 daemon/remote_generator.pl |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
index 351866b..bcf5fd4 100755
--- a/daemon/remote_generator.pl
+++ b/daemon/remote_generator.pl
@@ -1225,21 +1225,14 @@ elsif ($opt_k) {
 
         # select struct type for multi-return-value functions
         if ($multi_ret) {
-            my $last_arg;
-            my $struct_name = $call->{ProcName};
-            $struct_name =~ s/Get//;
-
-            if ($call->{ProcName} eq "DomainGetBlockInfo") {
-                # SPECIAL: virDomainGetBlockInfo has flags parameter after
-                #          the struct parameter in its signature
-                $last_arg = pop(@args_list);
+            if (!(defined $call->{ret_offset})) {
+                die "multi-return-value without insert@<offset> annotation: $call->{ret}";
             }
 
-            push(@args_list, "vir${struct_name}Ptr result");
+            my $struct_name = $call->{ProcName};
+            $struct_name =~ s/Get//;
 
-            if (defined $last_arg) {
-                push(@args_list, $last_arg);
-            }
+            splice(@args_list, $call->{ret_offset}, 0, ("vir${struct_name}Ptr result"));
         }
 
         if ($call->{streamflag} ne "none") {
-- 
1.7.0.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]