Going forward, we'd like to wrap long string literals. The recently introduced "pr_wrap_cstr" function may only be called right after the opening quote of the string literal has been produced. In the "print_trace_enter" function, we start a long string literal with "enter:"; however, because we either pass the literal to debug() or debug_direct(), this "enter:" is spelled out twice. Factor "enter:" out to a common line, also ensuring that we'll have as much room for wrapping as possible.
Example effect [lib/api.c]: > @@ -6220,7 +6360,8 @@ nbd_supports_uri (struct nbd_handle *h) > > /* This function must not call set_error. */ > if_debug (h) { > - debug_direct (h, "nbd_supports_uri", "enter:"); > + debug_direct (h, "nbd_supports_uri", > + "enter:"); > } > > ret = nbd_unlocked_supports_uri (h); > @@ -6260,7 +6401,8 @@ nbd_get_uri (struct nbd_handle *h) > > pthread_mutex_lock (&h->lock); > if_debug (h) { > - debug (h, "enter:"); > + debug (h, > + "enter:"); > } > > if (unlikely (!get_uri_in_permitted_state (h))) { Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516 Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- generator/C.ml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/generator/C.ml b/generator/C.ml index b65d3de2e82d..0ccf6970d43c 100644 --- a/generator/C.ml +++ b/generator/C.ml @@ -734,11 +734,17 @@ let | Int64 _ | SizeT _ | SockAddrAndLen _ | UInt _ | UInt32 _ | UInt64 _ | UIntPtr _ -> () ) args; - if may_set_error then - pr " debug (h, \"enter:" - else ( - pr " debug_direct (h, \"nbd_%s\", \"enter:" name - ); + let indent = + if may_set_error then ( + pr " debug (h,\n"; + spaces 11 + ) + else ( + pr " debug_direct (h, \"nbd_%s\",\n" name; + spaces 18 + ) in + pr "%s\"" indent; + pr "enter:"; List.iter ( function | Bool n -> pr " %s=%%s" n _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs