On 4/25/23 23:52, Eric Blake wrote:
On Tue, Apr 25, 2023 at 09:10:55AM +0200, Laszlo Ersek wrote:
> 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:");
Looks a little funny to not wrap here; but it's generated code, and
the context above makes it obvious why it is easier to wrap in both
places (when the debug_direct call above has an obvious reason for
wrapping). So far, I have no objections to this series, but I've hit
the end of my reviewing day.
For 1-11:
Reviewed-by: Eric Blake <eblake(a)redhat.com>
Thank you!
Laszlo