Dependent on "may_set_error", we (a) call debug() vs. debug_direct(), (b)
don't pass vs. pass the API name to the function from (a).
Currently this is (justifiedly) handled within a single "if"; however, for
wrapping the argument lists later -- with differrent indentations --,
let's now split the arg lists to separate invocations of "pr", at the cost
of another "if may_set_error".
This is a refactoring; it does not change the generated output.
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=2172516
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
generator/C.ml | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/generator/C.ml b/generator/C.ml
index 17b22d84d07d..7c8fffd89435 100644
--- a/generator/C.ml
+++ b/generator/C.ml
@@ -854,11 +854,14 @@ let
pr " nbd_internal_printable_string (ret);\n"
| _ -> ()
);
- pr " debug (h, \"leave: ret="
+ pr " debug ("
)
- else (
- pr " debug_direct (h, \"nbd_%s\", \"leave: ret=" name
- );
+ else
+ pr " debug_direct (";
+ if may_set_error then
+ pr "h, \"leave: ret="
+ else
+ pr "h, \"nbd_%s\", \"leave: ret=" name;
(match ret with
| RBool | RErr | RFd | RInt | REnum _ -> pr "%%d\", ret"
| RInt64 | RCookie -> pr "%%\" PRIi64, ret"