From 91d8b4eb5c770dfcc05f74dd0bd7b3fabc236530 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 2 Aug 2025 07:18:56 +0200 Subject: ftpd: code shrink, move replace_char() to libbb function old new delta modprobe_main 803 804 +1 escape_text 127 122 -5 replace 18 - -18 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/1 up/down: 1/-23) Total: -22 bytes Signed-off-by: Denys Vlasenko --- libbb/replace.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libbb/replace.c') diff --git a/libbb/replace.c b/libbb/replace.c index 6183d3e6f..bc26b04cc 100644 --- a/libbb/replace.c +++ b/libbb/replace.c @@ -46,3 +46,17 @@ char* FAST_FUNC xmalloc_substitute_string(const char *src, int count, const char //dbg_msg("subst9:'%s'", buf); return buf; } + +#if 0 /* inlined in libbb.h */ +/* Returns strlen as a bonus */ +size_t FAST_FUNC replace_char(char *str, char from, char to) +{ + char *p = str; + while (*p) { + if (*p == from) + *p = to; + p++; + } + return p - str; +} +#endif -- cgit v1.2.3-55-g6feb