Changeset 6b13103 for nick.c


Ignore:
Timestamp:
2015-01-16T19:50:23Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
1065dd4, eabe6d4
Parents:
6f10697
Message:

Replace isdigit/isalpha/.../tolower/toupper with glib variants

This fixes warnings about passing signed chars to them (apparently they
are implemented as macros that do array lookups without checks in some
platforms, yay)

Specifically:

functions=isalnum|isalpha|isdigit|isspace|isxdigit|tolower|toupper
sed -ir "s/$functions/g_ascii_&/g" /*.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nick.c

    r6f10697 r6b13103  
    4141        do {
    4242                if (*orig != ' ')
    43                         new[i++] = tolower( *orig );
     43                        new[i++] = g_ascii_tolower( *orig );
    4444        }
    4545        while (*(orig++));
     
    144144                                fmt += 2;
    145145                        }
    146                         else if( isdigit( *fmt ) )
     146                        else if( g_ascii_isdigit( *fmt ) )
    147147                        {
    148148                                len = 0;
    149149                                /* Grab a number. */
    150                                 while( isdigit( *fmt ) )
     150                                while( g_ascii_isdigit( *fmt ) )
    151151                                        len = len * 10 + ( *(fmt++) - '0' );
    152152                        }
     
    331331                }
    332332        }
    333         if( isdigit( nick[0] ) )
     333        if( g_ascii_isdigit( nick[0] ) )
    334334        {
    335335                char *orig;
     
    351351       
    352352        /* Empty/long nicks are not allowed, nor numbers at [0] */
    353         if( !*nick || isdigit( nick[0] ) || strlen( nick ) > MAX_NICK_LENGTH )
     353        if( !*nick || g_ascii_isdigit( nick[0] ) || strlen( nick ) > MAX_NICK_LENGTH )
    354354                return 0;
    355355       
Note: See TracChangeset for help on using the changeset viewer.