Changeset 9d8307a in mainline for uspace/lib/c/generic/stdlib.c
- Timestamp:
- 2018-07-19T11:55:19Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0d83cf6f
- Parents:
- 42f5860
- git-author:
- Jiri Svoboda <jiri@…> (2018-07-18 17:54:45)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-07-19 11:55:19)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/stdlib.c
r42f5860 r9d8307a 38 38 #include <stdlib.h> 39 39 #include "private/libc.h" 40 #include "private/scanf.h" 40 41 #include "private/stdlib.h" 42 #include "private/stdio.h" 43 #include "private/sstream.h" 41 44 42 45 static int glbl_seed = 1; … … 48 51 static FIBRIL_MUTEX_INITIALIZE(quick_exit_handlers_lock); 49 52 53 /** Convert string to long double. 54 * 55 */ 56 long double strtold(const char *nptr, char **endptr) 57 { 58 int numchar; 59 long double ld; 60 errno_t rc; 61 FILE f; 62 63 numchar = 0; 64 __sstream_init(nptr, &f); 65 66 rc = __fstrtold(&f, &numchar, SIZE_MAX, &ld); 67 if (rc != EOK) { 68 ld = 0; 69 if (endptr != NULL) 70 *endptr = (char *) nptr; 71 errno = rc; 72 } else { 73 if (endptr != NULL) 74 *endptr = (char *) __sstream_getpos(&f); 75 } 76 77 return ld; 78 } 50 79 51 80 int rand(void)
Note:
See TracChangeset
for help on using the changeset viewer.