In "print_trace_enter", when we iterate over the "args" and "optargs" lists with "List.iter" for printing the *values*, we use the "function" shorthand within the functions that get applied to each arg / optarg element. Expand the "function" shorthand to "fun" + "match", so we can more easily modify the code subsequently.
This patch is purely refactoring, it does not change the generated output. It is best viewed with "git show -b". Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516 Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- generator/C.ml | 42 +++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/generator/C.ml b/generator/C.ml index 0ccf6970d43c..6d880fb953e0 100644 --- a/generator/C.ml +++ b/generator/C.ml @@ -775,27 +775,31 @@ let ) optargs; pr "\""; List.iter ( - function - | Bool n -> pr ", %s ? \"true\" : \"false\"" n - | BytesOut (n, count) - | BytesPersistOut (n, count) -> pr ", %s" count - | BytesIn (n, count) - | BytesPersistIn (n, count) -> - pr ", %s_printable ? %s_printable : \"\", %s" n n count - | Closure { cbname } -> () - | Enum (n, _) -> pr ", %s" n - | Flags (n, _) -> pr ", %s" n - | Fd n | Int n | Int64 n | SizeT n -> pr ", %s" n - | SockAddrAndLen (_, len) -> pr ", (int) %s" len - | Path n | String n | StringList n -> - pr ", %s_printable ? %s_printable : \"\"" n n - | UInt n | UInt32 n | UInt64 n | UIntPtr n -> pr ", %s" n + fun arg -> + (match arg with + | Bool n -> pr ", %s ? \"true\" : \"false\"" n + | BytesOut (n, count) + | BytesPersistOut (n, count) -> pr ", %s" count + | BytesIn (n, count) + | BytesPersistIn (n, count) -> + pr ", %s_printable ? %s_printable : \"\", %s" n n count + | Closure { cbname } -> () + | Enum (n, _) -> pr ", %s" n + | Flags (n, _) -> pr ", %s" n + | Fd n | Int n | Int64 n | SizeT n -> pr ", %s" n + | SockAddrAndLen (_, len) -> pr ", (int) %s" len + | Path n | String n | StringList n -> + pr ", %s_printable ? %s_printable : \"\"" n n + | UInt n | UInt32 n | UInt64 n | UIntPtr n -> pr ", %s" n + ) ) args; List.iter ( - function - | OClosure { cbname } -> - pr ", CALLBACK_IS_NULL (%s_callback) ? \"<fun>\" : \"NULL\"" cbname - | OFlags (n, _, _) -> pr ", %s" n + fun optarg -> + (match optarg with + | OClosure { cbname } -> + pr ", CALLBACK_IS_NULL (%s_callback) ? \"<fun>\" : \"NULL\"" cbname + | OFlags (n, _, _) -> pr ", %s" n + ) ) optargs; pr ");\n"; List.iter ( _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs