/
niceSOFT
/
shadow
Обзор
Документация
Войти
/
niceSOFT
/
shadow
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
lib/string/sprintf/seprintf.h
66 строк
1 KB
Alejandro Colomar
lib/string/: seprintf(), stpecpy(): Add missing const
15 май 2026, 13:06
15 май 2026, 13:06
ac46a34
Код
Авторство
О чём код?
// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar <alx@kernel.org> // SPDX-License-Identifier: BSD-3-Clause #ifndef SHADOW_INCLUDE_LIB_STRING_SPRINTF_SEPRINTF_H_ #define SHADOW_INCLUDE_LIB_STRING_SPRINTF_SEPRINTF_H_ #include "config.h" #include <stdarg.h> #include <stddef.h> #include "attr.h" #include "string/sprintf/stprintf.h" #if !defined(HAVE_SEPRINTF) // seprintf - string end-pointer print formatted format_attr(printf, 3, 4) inline char *seprintf(char *dst, const char *end, const char *restrict fmt, ...); // vseprintf - va_list string end-pointer print formatted format_attr(printf, 3, 0) inline char *vseprintf(char *dst, const char *end, const char *restrict fmt, va_list ap); #endif #if !defined(HAVE_SEPRINTF) inline char * seprintf(char *dst, const char *end, const char *restrict fmt, ...) { char *p; va_list ap; va_start(ap, fmt); p = vseprintf(dst, end, fmt, ap); va_end(ap); return p; } #endif #if !defined(HAVE_SEPRINTF) inline char * vseprintf(char *dst, const char *end, const char *restrict fmt, va_list ap) { int len; ptrdiff_t size; if (dst == NULL) return NULL; size = end - dst; len = vstprintf(dst, size, fmt, ap); if (len == -1) return NULL; return dst + len; } #endif #endif // include guard