Changeset 2b3dd78 in mainline for uspace/lib/posix/src/stdlib/strtold.c
- Timestamp:
- 2018-01-31T12:02:00Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5595841
- Parents:
- a0a9cc2 (diff), 14d789c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 moved
-
uspace/lib/posix/src/stdlib/strtold.c (moved) (moved from uspace/lib/posix/source/stdlib/strtold.c ) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/src/stdlib/strtold.c
ra0a9cc2 r2b3dd78 33 33 */ 34 34 35 #define LIBPOSIX_INTERNAL36 #define __POSIX_DEF__(x) posix_##x37 38 35 #include "../internal/common.h" 39 36 #include "libc/stdbool.h" … … 50 47 51 48 #include "posix/float.h" 49 50 #include "libc/str.h" 52 51 53 52 #ifndef HUGE_VALL … … 345 344 bool after_decimal = false; 346 345 347 while ( posix_isxdigit(*str) || (!after_decimal && *str == DECIMAL_POINT)) {346 while (isxdigit(*str) || (!after_decimal && *str == DECIMAL_POINT)) { 348 347 if (*str == DECIMAL_POINT) { 349 348 after_decimal = true; … … 405 404 * @return An approximate representation of the input floating-point number. 406 405 */ 407 long double posix_strtold(const char *restrict nptr, char **restrict endptr)406 long double strtold(const char *restrict nptr, char **restrict endptr) 408 407 { 409 408 assert(nptr != NULL); … … 431 430 432 431 /* check for NaN */ 433 if ( posix_strncasecmp(&nptr[i], "nan", 3) == 0) {432 if (strncasecmp(&nptr[i], "nan", 3) == 0) { 434 433 // FIXME: return NaN 435 434 // TODO: handle the parenthesised case … … 443 442 444 443 /* check for Infinity */ 445 if ( posix_strncasecmp(&nptr[i], "inf", 3) == 0) {444 if (strncasecmp(&nptr[i], "inf", 3) == 0) { 446 445 i += 3; 447 if ( posix_strncasecmp(&nptr[i], "inity", 5) == 0) {446 if (strncasecmp(&nptr[i], "inity", 5) == 0) { 448 447 i += 5; 449 448 } … … 457 456 /* check for a hex number */ 458 457 if (nptr[i] == '0' && tolower(nptr[i + 1]) == 'x' && 459 ( posix_isxdigit(nptr[i + 2]) ||460 (nptr[i + 2] == RADIX && posix_isxdigit(nptr[i + 3])))) {458 (isxdigit(nptr[i + 2]) || 459 (nptr[i + 2] == RADIX && isxdigit(nptr[i + 3])))) { 461 460 i += 2; 462 461
Note:
See TracChangeset
for help on using the changeset viewer.
