Instead of creating the `unique_id` ist with length zero and then immediately adjusting the length we can just construct it with the correct length directly.
Reviewed-by: Volker Dusch <[email protected]> --- src/stream.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/stream.c b/src/stream.c index 40f9f75ae..ca12f14e8 100644 --- a/src/stream.c +++ b/src/stream.c @@ -3098,12 +3098,13 @@ struct ist stream_generate_unique_id(struct stream *strm, struct lf_expr *format } else { char *unique_id; + size_t len; if ((unique_id = pool_alloc(pool_head_uniqueid)) == NULL) return IST_NULL; - strm->unique_id = ist2(unique_id, 0); - strm->unique_id.len = build_logline(strm, unique_id, UNIQUEID_LEN, format); + len = build_logline(strm, unique_id, UNIQUEID_LEN, format); + strm->unique_id = ist2(unique_id, len); return strm->unique_id; } -- 2.53.0

