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/replace.c | |
| parent | 2d7ff2c909c6dce95a8780d00e2089f0c507dd25 (diff) | |
| download | busybox-w32-91d8b4eb5c770dfcc05f74dd0bd7b3fabc236530.tar.gz busybox-w32-91d8b4eb5c770dfcc05f74dd0bd7b3fabc236530.tar.bz2 busybox-w32-91d8b4eb5c770dfcc05f74dd0bd7b3fabc236530.zip | |
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/replace.c')
| -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 | |||
| 46 | //dbg_msg("subst9:'%s'", buf); | 46 | //dbg_msg("subst9:'%s'", buf); |
| 47 | return buf; | 47 | return buf; |
| 48 | } | 48 | } |
| 49 | |||
| 50 | #if 0 /* inlined in libbb.h */ | ||
| 51 | /* Returns strlen as a bonus */ | ||
| 52 | size_t FAST_FUNC replace_char(char *str, char from, char to) | ||
| 53 | { | ||
| 54 | char *p = str; | ||
| 55 | while (*p) { | ||
| 56 | if (*p == from) | ||
| 57 | *p = to; | ||
| 58 | p++; | ||
| 59 | } | ||
| 60 | return p - str; | ||
| 61 | } | ||
| 62 | #endif | ||
