Willy,

Am 05.03.20 um 19:51 schrieb Willy Tarreau:
> On Thu, Mar 05, 2020 at 05:56:36PM +0100, Tim Duesterhus wrote:
>> diff --git a/src/stream.c b/src/stream.c
>> index 331f24be7..4fd76c69b 100644
>> --- a/src/stream.c
>> +++ b/src/stream.c
>> @@ -170,8 +170,11 @@ static void strm_trace(enum trace_level level, uint64_t 
>> mask, const struct trace
>>      /* General info about the stream (htx/tcp, id...) */
>>      chunk_appendf(&trace_buf, " : [%u,%s]",
>>                    s->uniq_id, ((s->flags & SF_HTX) ? "HTX" : "TCP"));
>> -    if (s->unique_id)
>> -            chunk_appendf(&trace_buf, " id=%s", s->unique_id);
>> +    if (isttest(s->unique_id)) {
>> +            chunk_appendf(&trace_buf, " id=");
>> +            for (size_t i = 0; i < s->unique_id.len; i++)
>> +                    b_putchr(&trace_buf, s->unique_id.ptr[i]);
>> +    }
> 
> 
> You have b_putist(&trace_buf, s->unique_id) to avoid the for loop above.
> I'll let you double-check in case I missed anything but I'm assuming you
> just didn't spot it.

No, you are correct. I wasn't aware that thing existed. Either adjust
yourself or let me know if I should resend.

I believe that in this place I technically could just pass the `.ptr` of
the ist, because the unique ID is guaranteed to be null-terminated, but
that felt unclean to me, so I wrote that manual loop.

Best regards
Tim Düsterhus

Reply via email to