mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
(parse_256_or_true_color_name): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
31320b597c
commit
b19c336951
@ -135,13 +135,15 @@ parse_256_or_true_color_name (const char *color_name)
|
|||||||
}
|
}
|
||||||
if (color_name[0] == '#')
|
if (color_name[0] == '#')
|
||||||
{
|
{
|
||||||
|
int len;
|
||||||
int h[6];
|
int h[6];
|
||||||
|
|
||||||
color_name++;
|
color_name++;
|
||||||
if (strlen (color_name) != 3 && strlen (color_name) != 6)
|
len = (int) strlen (color_name);
|
||||||
|
if (len != 3 && len != 6)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; color_name[i] != '\0'; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
h[i] = parse_hex_digit (color_name[i]);
|
h[i] = parse_hex_digit (color_name[i]);
|
||||||
if (h[i] == -1)
|
if (h[i] == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user