[PATCH v9 17/37] net: move copy_filename() to new file net/net-common.c
Jerome Forissier
jerome.forissier at linaro.org
Fri Aug 23 15:48:21 CEST 2024
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.
Signed-off-by: Jerome Forissier <jerome.forissier at linaro.org>
---
net/Makefile | 2 ++
net/net-common.c | 13 +++++++++++++
net/net.c | 12 ------------
3 files changed, 15 insertions(+), 12 deletions(-)
create mode 100644 net/net-common.c
diff --git a/net/Makefile b/net/Makefile
index 70eec8caf0d..a9cecee637a 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -42,3 +42,5 @@ obj-$(CONFIG_CMD_WGET) += wget.o
CFLAGS_eth_common.o += -Wno-format-extra-args
endif
+
+obj-y += net-common.o
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';
+}
diff --git a/net/net.c b/net/net.c
index d9bc9df643f..32629aa80ce 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1684,18 +1684,6 @@ void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, int sport,
ip->udp_xsum = 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';
-}
-
int is_serverip_in_cmd(void)
{
return !!strchr(net_boot_file_name, ':');
--
2.40.1
More information about the U-Boot
mailing list