New upstream version 4.19.0
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "config.h"
|
||||
|
||||
#include "string/sprintf/aprintf.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define SHADOW_INCLUDE_LIB_STRING_SPRINTF_APRINTF_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
@@ -14,6 +14,11 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "attr.h"
|
||||
#include "exit_if_null.h"
|
||||
|
||||
|
||||
// exit-on-error allocate print formatted
|
||||
#define xaprintf(...) exit_if_null(aprintf(__VA_ARGS__))
|
||||
|
||||
|
||||
ATTR_MALLOC(free)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "config.h"
|
||||
|
||||
#include "string/sprintf/snprintf.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define SHADOW_INCLUDE_LIB_STRING_SPRINTF_SNPRINTF_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
@@ -16,7 +16,8 @@
|
||||
#include "sizeof.h"
|
||||
|
||||
|
||||
#define SNPRINTF(s, fmt, ...) \
|
||||
// stprintf_a - string truncate print formatted array
|
||||
#define stprintf_a(s, fmt, ...) \
|
||||
( \
|
||||
snprintf_(s, countof(s), fmt __VA_OPT__(,) __VA_ARGS__) \
|
||||
)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "config.h"
|
||||
|
||||
#include "string/sprintf/stpeprintf.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define SHADOW_INCLUDE_LIB_STRING_SPRINTF_STPEPRINTF_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "string/sprintf/xaprintf.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
extern inline char *xaprintf(const char *restrict fmt, ...);
|
||||
extern inline char *xvaprintf(const char *restrict fmt, va_list ap);
|
||||
@@ -1,59 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_STRING_SPRINTF_XASPRINTF_H_
|
||||
#define SHADOW_INCLUDE_LIB_STRING_SPRINTF_XASPRINTF_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "attr.h"
|
||||
#include "string/sprintf/aprintf.h"
|
||||
|
||||
|
||||
ATTR_MALLOC(free)
|
||||
format_attr(printf, 1, 2)
|
||||
inline char *xaprintf(const char *restrict fmt, ...);
|
||||
|
||||
ATTR_MALLOC(free)
|
||||
format_attr(printf, 1, 0)
|
||||
inline char *xvaprintf(const char *restrict fmt, va_list ap);
|
||||
|
||||
|
||||
// exit-on-error allocate print formatted
|
||||
inline char *
|
||||
xaprintf(const char *restrict fmt, ...)
|
||||
{
|
||||
char *p;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
p = xvaprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
inline char *
|
||||
xvaprintf(const char *restrict fmt, va_list ap)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = vaprintf(fmt, ap);
|
||||
if (p == NULL) {
|
||||
perror("vaprintf");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
Reference in New Issue
Block a user