strip_colour: Prefer IsDigit to isdigit.

Unlike isdigit, IsDigit can safely be applied to 'char's.
Arguments to isdigit needs a character cast to 'unsigned char' or EOF.
This commit is contained in:
Jilles Tjoelker 2012-03-15 00:58:56 +01:00
parent aba43ba823
commit 57b1cd5f6b

View file

@ -39,15 +39,15 @@ strip_colour(char *string)
switch (*c) switch (*c)
{ {
case 3: case 3:
if(isdigit(c[1])) if(IsDigit(c[1]))
{ {
c++; c++;
if(isdigit(c[1])) if(IsDigit(c[1]))
c++; c++;
if(c[1] == ',' && isdigit(c[2])) if(c[1] == ',' && IsDigit(c[2]))
{ {
c += 2; c += 2;
if(isdigit(c[1])) if(IsDigit(c[1]))
c++; c++;
} }
} }
@ -91,15 +91,15 @@ strip_unprintable(char *string)
switch (*c) switch (*c)
{ {
case 3: case 3:
if(isdigit(c[1])) if(IsDigit(c[1]))
{ {
c++; c++;
if(isdigit(c[1])) if(IsDigit(c[1]))
c++; c++;
if(c[1] == ',' && isdigit(c[2])) if(c[1] == ',' && IsDigit(c[2]))
{ {
c += 2; c += 2;
if(isdigit(c[1])) if(IsDigit(c[1]))
c++; c++;
} }
} }