Reset upstream to 4.16.0
Gbp-Dch: ignore
This commit is contained in:
@@ -531,7 +531,6 @@ EGREP = @EGREP@
|
||||
ETAGS = @ETAGS@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
FILECMD = @FILECMD@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
|
||||
+21
-31
@@ -5,7 +5,6 @@
|
||||
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -29,29 +28,13 @@
|
||||
static jmp_buf jmpb;
|
||||
|
||||
|
||||
/**********************
|
||||
* WRAPPERS
|
||||
**********************/
|
||||
int __real_vasprintf(char **restrict p, const char *restrict fmt, va_list ap);
|
||||
int __wrap_vasprintf(char **restrict p, const char *restrict fmt, va_list ap);
|
||||
void __wrap_exit(int status);
|
||||
|
||||
[[gnu::noipa]]
|
||||
static int xasprintf_volatile(char *volatile *restrict s,
|
||||
const char *restrict fmt, ...);
|
||||
|
||||
static void test_xasprintf_exit(void **state);
|
||||
static void test_xasprintf_ok(void **state);
|
||||
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(test_xasprintf_exit),
|
||||
cmocka_unit_test(test_xasprintf_ok),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
__wrap_vasprintf(char **restrict p, const char *restrict fmt, va_list ap)
|
||||
@@ -67,16 +50,11 @@ __wrap_exit(int status)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
xasprintf_volatile(char *volatile *restrict s, const char *restrict fmt, ...)
|
||||
{
|
||||
int len;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
len = xvasprintf((char **) s, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
/**********************
|
||||
* TEST
|
||||
**********************/
|
||||
static void test_xasprintf_exit(void **state);
|
||||
static void test_xasprintf_ok(void **state);
|
||||
|
||||
|
||||
static void
|
||||
@@ -92,7 +70,7 @@ test_xasprintf_exit(void **state)
|
||||
switch (setjmp(jmpb)) {
|
||||
case 0:
|
||||
len = XASPRINTF_CALLED;
|
||||
len = xasprintf_volatile(&p, "foo%s", "bar");
|
||||
len = xasprintf(&p, "foo%s", "bar");
|
||||
assert_unreachable();
|
||||
break;
|
||||
case EXIT_CALLED:
|
||||
@@ -122,3 +100,15 @@ test_xasprintf_ok(void **state)
|
||||
assert_string_equal(p, "foo1bar");
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(test_xasprintf_exit),
|
||||
cmocka_unit_test(test_xasprintf_ok),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user