diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2025-08-02 07:18:56 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2025-08-02 07:18:56 +0200 |
| commit | 91d8b4eb5c770dfcc05f74dd0bd7b3fabc236530 (patch) | |
| tree | a0a6d5c8e5b08e61b1241be8cbe19d27b249833f /libbb | |
| parent | 2d7ff2c909c6dce95a8780d00e2089f0c507dd25 (diff) | |
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 <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/replace.c | 14 |
1 files changed, 14 insertions, 0 deletions
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 |
