Skip to content
  • Alan Coopersmith's avatar
    cfgscan: check if character is EOF before calling isalpha or isdigit · 0bb93230
    Alan Coopersmith authored
    
    
    Resolves cppcheck warnings:
    
    cfgscan.c:475:22: warning: Either the condition 'ch==-1' is redundant or
     isalpha() argument nr 1 can have invalid value. The value is -1 but the
     valid values are '0:255'. [invalidFunctionArg]
        else if (isalpha(ch) || (ch == '_'))
                         ^
    cfgscan.c:479:17: note: Assuming that condition 'ch==-1' is not redundant
        else if (ch == EOF)
                    ^
    cfgscan.c:475:22: note: Invalid argument
        else if (isalpha(ch) || (ch == '_'))
                         ^
    cfgscan.c:477:22: warning: Either the condition 'ch==-1' is redundant or
     isdigit() argument nr 1 can have invalid value. The value is -1 but the
     valid values are '0:255'. [invalidFunctionArg]
        else if (isdigit(ch))
                         ^
    cfgscan.c:479:17: note: Assuming that condition 'ch==-1' is not redundant
        else if (ch == EOF)
                    ^
    cfgscan.c:477:22: note: Invalid argument
        else if (isdigit(ch))
                         ^
    
    Signed-off-by: default avatarAlan Coopersmith <alan.coopersmith@oracle.com>
    0bb93230