7e213cfb50
[v]stpeprintf() are similar to [v]snprintf(3), but they allow chaining. [v]snprintf(3) are very dangerous for catenating strings, since the obvious ways to do it invoke Undefined Behavior, and the ways that avoid UB are very error-prone. Cc: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
26 lines
460 B
C
26 lines
460 B
C
/*
|
|
* SPDX-FileCopyrightText: 2022 - 2023, Alejandro Colomar <alx@kernel.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#if !defined(HAVE_STPEPRINTF)
|
|
|
|
#ident "$Id$"
|
|
|
|
#include "stpeprintf.h"
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
extern inline char *stpeprintf(char *dst, char *end, const char *restrict fmt,
|
|
...);
|
|
extern inline char *vstpeprintf(char *dst, char *end, const char *restrict fmt,
|
|
va_list ap);
|
|
|
|
|
|
#endif // !HAVE_STPEPRINTF
|