Elyes Haouas bdd03c20d5 tree: Use <stdio.h> for snprintf
<stdio.h> header is used for input/output operations (such as printf,
scanf, fopen, etc.). Although some input/output functions can manipulate
strings, they do not need to directly include <string.h> because they
are declared independently.

Change-Id: Ibe2a4ff6f68843a6d99cfdfe182cf2dd922802aa
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82665
Reviewed-by: Yidi Lin <yidilin@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-05-29 10:33:54 +00:00

16 lines
360 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <stdarg.h>
#include <tests/test.h>
void die(const char *msg, ...)
{
/* die() can be called in middle a function, so we should not allow for it to return */
static char msg_buf[256];
va_list v;
va_start(v, msg);
vsnprintf(msg_buf, ARRAY_SIZE(msg_buf), msg, v);
va_end(v);
fail_msg("%s", msg_buf);
}