From 1d5d292b79415abf3d0214cd2f707b43cf9fdfbf Mon Sep 17 00:00:00 2001 From: Jerome Forissier Date: Wed, 16 Oct 2024 12:04:00 +0200 Subject: net: split net into net{,-common,-legacy,-lwip} Make net.h a wrapper which includes net-common.h and either net-legacy.h or net-lwip.h based on NET_LWIP. The function copy_filename() can be useful when NET_LWIP is enabled, therefore move it out of net/net.c which is built only when networking choice is NET and create a new file net/net-common.c. Signed-off-by: Jerome Forissier Acked-by: Ilias Apalodimas --- net/net-common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 net/net-common.c (limited to 'net/net-common.c') diff --git a/net/net-common.c b/net/net-common.c new file mode 100644 index 00000000000..a7f767d5e9c --- /dev/null +++ b/net/net-common.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +void copy_filename(char *dst, const char *src, int size) +{ + if (src && *src && (*src == '"')) { + ++src; + --size; + } + + while ((--size > 0) && src && *src && (*src != '"')) + *dst++ = *src++; + *dst = '\0'; +} -- cgit v1.2.3