Changeset 6b13103 for lib/misc.c


Ignore:
Timestamp:
2015-01-16T19:50:23Z (5 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
  • lib/misc.c

    r6f10697 r6b13103  
    163163        while( *in )
    164164        {
    165                 if( *in == '<' && ( isalpha( *(in+1) ) || *(in+1) == '/' ) )
     165                if( *in == '<' && ( g_ascii_isalpha( *(in+1) ) || *(in+1) == '/' ) )
    166166                {
    167167                        /* If in points at a < and in+1 points at a letter or a slash, this is probably
     
    198198                {
    199199                        cs = ++in;
    200                         while( *in && isalpha( *in ) )
     200                        while( *in && g_ascii_isalpha( *in ) )
    201201                                in ++;
    202202                       
     
    314314        for( i = j = 0; t[i]; i ++, j ++ )
    315315        {
    316                 /* Warning: isalnum() is locale-aware, so don't use it here! */
     316                /* Warning: g_ascii_isalnum() is locale-aware, so don't use it here! */
    317317                if( ( t[i] >= 'A' && t[i] <= 'Z' ) ||
    318318                    ( t[i] >= 'a' && t[i] <= 'z' ) ||
     
    490490       
    491491        while( *value )
    492                 if( !isdigit( *value ) )
     492                if( !g_ascii_isdigit( *value ) )
    493493                        return 0;
    494494                else
Note: See TracChangeset for help on using the changeset viewer.