Bluetooth: Move re-implementation of snprintk

Move the function in the `subsys/testsuite/ztest/src/ztest_mock.c` files.

This is motivated by the fact that there is others re-implementation of
`*printk` functions using libc counterparts in the `ztest_mock.c` file.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This commit is contained in:
Théo Battrel 2022-10-28 11:05:01 +02:00 committed by Carles Cufí
commit effb76c61e
2 changed files with 13 additions and 14 deletions

View file

@ -56,6 +56,19 @@ void vprintk(const char *fmt, va_list ap)
{
vprintf(fmt, ap);
}
int snprintk(char *str, size_t size, const char *fmt, ...)
{
va_list ap;
int ret;
va_start(ap, fmt);
ret = snprintf(str, size, fmt, ap);
va_end(ap);
return ret;
}
#else
/*

View file

@ -4,7 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdio.h>
#include <zephyr/kernel.h>
#include <zephyr/bluetooth/addr.h>
#include <host/keys.h>
@ -17,19 +16,6 @@
DEFINE_FFF_GLOBALS;
/* Define snprintk to use libc since we are not compiling the whole kernel. */
int snprintk(char *str, size_t size, const char *fmt, ...)
{
va_list ap;
int ret;
va_start(ap, fmt);
ret = snprintf(str, size, fmt, ap);
va_end(ap);
return ret;
}
/* This LUT contains different combinations of ID and Address pairs */
const struct id_addr_pair testing_id_addr_pair_lut[] = {
{ BT_ADDR_ID_1, BT_ADDR_LE_1 },