aboutsummaryrefslogtreecommitdiff
path: root/include/libbb.h
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2025-08-02 07:18:56 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2025-08-02 07:18:56 +0200
commit91d8b4eb5c770dfcc05f74dd0bd7b3fabc236530 (patch)
treea0a6d5c8e5b08e61b1241be8cbe19d27b249833f /include/libbb.h
parent2d7ff2c909c6dce95a8780d00e2089f0c507dd25 (diff)
downloadbusybox-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 'include/libbb.h')
-rw-r--r--include/libbb.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h
index cdc05049c..895200192 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1113,6 +1113,19 @@ char *bin2hex(char *dst, const char *src, int count) FAST_FUNC;
1113/* Reverse */ 1113/* Reverse */
1114char* hex2bin(char *dst, const char *src, int count) FAST_FUNC; 1114char* hex2bin(char *dst, const char *src, int count) FAST_FUNC;
1115 1115
1116/* Returns strlen as a bonus */
1117//size_t replace_char(char *s, char what, char with) FAST_FUNC;
1118static inline size_t replace_char(char *str, char from, char to)
1119{
1120 char *p = str;
1121 while (*p) {
1122 if (*p == from)
1123 *p = to;
1124 p++;
1125 }
1126 return p - str;
1127}
1128
1116extern const char c_escape_conv_str00[]; 1129extern const char c_escape_conv_str00[];
1117#define c_escape_conv_str07 (c_escape_conv_str00+3) 1130#define c_escape_conv_str07 (c_escape_conv_str00+3)
1118 1131