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:
parent
a57dbb15db
commit
effb76c61e
2 changed files with 13 additions and 14 deletions
|
@ -56,6 +56,19 @@ void vprintk(const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
vprintf(fmt, 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
|
#else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
#include <zephyr/bluetooth/addr.h>
|
#include <zephyr/bluetooth/addr.h>
|
||||||
#include <host/keys.h>
|
#include <host/keys.h>
|
||||||
|
@ -17,19 +16,6 @@
|
||||||
|
|
||||||
DEFINE_FFF_GLOBALS;
|
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 */
|
/* This LUT contains different combinations of ID and Address pairs */
|
||||||
const struct id_addr_pair testing_id_addr_pair_lut[] = {
|
const struct id_addr_pair testing_id_addr_pair_lut[] = {
|
||||||
{ BT_ADDR_ID_1, BT_ADDR_LE_1 },
|
{ BT_ADDR_ID_1, BT_ADDR_LE_1 },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue