From 58eb7e31a66d5e0fdcbb1796d0547f00680d00aa Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 2 Nov 2025 16:51:36 +0100 Subject: [PATCH] helper: log: document the last user of hack in alloc_vprintf() Apparently the last user of the hack in alloc_vprintf() is the code in log_vprintf_lf(). Document it for future rework. Change-Id: I6b69f8b7f3feb93e5daa9649c4122ec12e22d84f Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/9317 Tested-by: jenkins --- src/helper/log.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/helper/log.c b/src/helper/log.c index 7acb154c6..eec0c04dd 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -364,7 +364,8 @@ char *alloc_vprintf(const char *fmt, va_list ap) /* allocate and make room for terminating zero. */ /* FIXME: The old version always allocated at least one byte extra and * other code depend on that. They should be probably be fixed, but for - * now reserve the extra byte. */ + * now reserve the extra byte. Apparently the last user of such hack is + * log_vprintf_lf() that adds a trailing newline. */ string = malloc(len + 2); if (!string) return NULL;