Check for a valid number character: [-+0-9a-yA-Y.] * Eg: -0.6e+5, infinity, 0xF0.F0pF0 * * Used to find the probable end of a number. It doesn't matter if * invalid characters are counted - strtod() will find the valid * number if it exists. The risk is that slightly more memory might * be allocated before a parse error occurs. */
| 73 | * number if it exists. The risk is that slightly more memory might |
| 74 | * be allocated before a parse error occurs. */ |
| 75 | static inline int valid_number_character(char ch) |
| 76 | { |
| 77 | char lower_ch; |
| 78 | |
| 79 | if ('0' <= ch && ch <= '9') |
| 80 | return 1; |
| 81 | if (ch == '-' || ch == '+' || ch == '.') |
| 82 | return 1; |
| 83 | |
| 84 | /* Hex digits, exponent (e), base (p), "infinity",.. */ |
| 85 | lower_ch = ch | 0x20; |
| 86 | if ('a' <= lower_ch && lower_ch <= 'y') |
| 87 | return 1; |
| 88 | |
| 89 | return 0; |
| 90 | } |
| 91 | |
| 92 | /* Calculate the size of the buffer required for a strtod locale |
| 93 | * conversion. */ |
no outgoing calls
no test coverage detected