mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
ls: tune is_colored
* src/ls.c (is_colored): Tune. This shrinks the machine code considerably on x86-64.
This commit is contained in:
1 parent
65c58007f7
commit
ec0fe0d2b8
1 file changed
+6
-3
@@ -1464,11 +1464,14 @@ free_pending_ent (struct pending *p)
|
||||
static bool
|
||||
is_colored (enum indicator_no type)
|
||||
{
|
||||
/* Return true unless the string is "", "0" or "00"; try to be efficient. */
|
||||
size_t len = color_indicator[type].len;
|
||||
if (len == 0)
|
||||
return false;
|
||||
if (2 < len)
|
||||
return true;
|
||||
char const *s = color_indicator[type].string;
|
||||
return ! (len == 0
|
||||
|| (len == 1 && STRNCMP_LIT (s, "0") == 0)
|
||||
|| (len == 2 && STRNCMP_LIT (s, "00") == 0));
|
||||
return (s[0] != '0') | (s[len - 1] != '0');
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in new issue
Block a user