aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2017-11-23 19:49:31 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-02-27 13:35:40 +0100
commitcc222747ae7e264cbe9b1c8a9c253860275db8a9 (patch)
tree9486f9f3c9bca6263ed68fdd27869537aa4ea205
parentd82ea2ba8f9486d338b3aefe161afd4f77ce7a86 (diff)
downloadbusybox-cc222747ae7e264cbe9b1c8a9c253860275db8a9.tar.gz
libbb: Use return value from is_prefixed_with()
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5 (-5) Function old new delta skip_dev_pfx 30 25 -5 Total: Before=779966, After=779961, chg -0.00% Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/skip_whitespace.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libbb/skip_whitespace.c b/libbb/skip_whitespace.c
index 4df5d9e4d..37a24d3be 100644
--- a/libbb/skip_whitespace.c
+++ b/libbb/skip_whitespace.c
@@ -32,7 +32,6 @@ char* FAST_FUNC skip_non_whitespace(const char *s)
char* FAST_FUNC skip_dev_pfx(const char *tty_name)
{
- if (is_prefixed_with(tty_name, "/dev/"))
- tty_name += 5;
- return (char*)tty_name;
+ char *unprefixed = is_prefixed_with(tty_name, "/dev/");
+ return unprefixed ? unprefixed : (char*)tty_name;
}