diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-05 17:50:35 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-05 17:50:35 +0200 |
commit | 20077c1429915b2c223e4d179a033f2b1806872c (patch) | |
tree | 76c89e23adc5bb529e310d9e25e7016f6d699645 /procps | |
parent | 9cf89cdf84fb20154088145980b676d2b28fc55d (diff) | |
download | busybox-w32-20077c1429915b2c223e4d179a033f2b1806872c.tar.gz busybox-w32-20077c1429915b2c223e4d179a033f2b1806872c.tar.bz2 busybox-w32-20077c1429915b2c223e4d179a033f2b1806872c.zip |
libbb: make trim() return pointer to terminating NUL
function old new delta
trim 80 90 +10
angle_address 56 50 -6
sysctl_main 282 273 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: +10/-15) Total: -5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r-- | procps/sysctl.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/procps/sysctl.c b/procps/sysctl.c index 619f4f1e4..ef1a1b99f 100644 --- a/procps/sysctl.c +++ b/procps/sysctl.c | |||
@@ -257,12 +257,16 @@ static int sysctl_handle_preload_file(const char *filename) | |||
257 | parse_flags &= ~PARSE_EOL_COMMENTS; // NO (only first char) - comments are recognized even if not first char | 257 | parse_flags &= ~PARSE_EOL_COMMENTS; // NO (only first char) - comments are recognized even if not first char |
258 | while (config_read(parser, token, 2, 2, "#=", parse_flags)) { | 258 | while (config_read(parser, token, 2, 2, "#=", parse_flags)) { |
259 | char *tp; | 259 | char *tp; |
260 | trim(token[0]); | 260 | |
261 | trim(token[1]); | 261 | trim(token[1]); |
262 | tp = trim(token[0]); | ||
262 | sysctl_dots_to_slashes(token[0]); | 263 | sysctl_dots_to_slashes(token[0]); |
263 | tp = xasprintf("%s=%s", token[0], token[1]); | 264 | /* ^^^converted in-place. tp still points to NUL */ |
264 | sysctl_act_on_setting(tp); | 265 | /* now, add "=TOKEN1" */ |
265 | free(tp); | 266 | *tp++ = '='; |
267 | overlapping_strcpy(tp, token[1]); | ||
268 | |||
269 | sysctl_act_on_setting(token[0]); | ||
266 | } | 270 | } |
267 | if (ENABLE_FEATURE_CLEAN_UP) | 271 | if (ENABLE_FEATURE_CLEAN_UP) |
268 | config_close(parser); | 272 | config_close(parser); |