[Libguestfs] [PATCH 08/10] c: Fix prototype generator when last argument is a BufferIn

Matthew Booth mbooth at redhat.com
Fri Jan 20 11:07:51 UTC 2012


We were passing the name of the last argument directly to va_start. However, if
the last argument is a BufferIn it expands to 2 arguments, the latter of which
is <name>_size.
---
 generator/generator_c.ml |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/generator/generator_c.ml b/generator/generator_c.ml
index 35c0534..ba6a324 100644
--- a/generator/generator_c.ml
+++ b/generator/generator_c.ml
@@ -1404,7 +1404,13 @@ trace_send_line (guestfs_h *g)
           | _ ->
               match args with
               | [] -> "g"
-              | args -> name_of_argt (List.hd (List.rev args)) in
+              | args ->
+                let last = (List.hd (List.rev args)) in
+                let name = name_of_argt last in
+                match last with
+                | BufferIn n -> name ^ "_size"
+                | _ -> name
+        in
 
         let rtype =
           match ret with
-- 
1.7.7.5




More information about the Libguestfs mailing list