libbb: Use return value from is_prefixed_with()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 23 Nov 2017 17:49:31 +0000 (19:49 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 27 Feb 2018 12:35:40 +0000 (13:35 +0100)
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>
libbb/skip_whitespace.c

index 4df5d9e4d4ab63d9a8d336dc7709476673ed83bc..37a24d3be632834d1a7671a87aac8723a37a59fd 100644 (file)
@@ -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;
 }