summaryrefslogtreecommitdiff
path: root/src/inttypes
diff options
context:
space:
mode:
Diffstat (limited to 'src/inttypes')
-rw-r--r--src/inttypes/strtoimax.c17
-rw-r--r--src/inttypes/strtoumax.c13
-rw-r--r--src/inttypes/wcstoimax.c17
-rw-r--r--src/inttypes/wcstoumax.c13
4 files changed, 28 insertions, 32 deletions
diff --git a/src/inttypes/strtoimax.c b/src/inttypes/strtoimax.c
index 5a68c47c..e473c210 100644
--- a/src/inttypes/strtoimax.c
+++ b/src/inttypes/strtoimax.c
@@ -1,19 +1,16 @@
+#include "stddef.h"
#include <inttypes.h>
+#include "errno.h"
intmax_t strtoimax(const char * restrict nptr, char ** restrict endptr, int base)
{
- /* like strotoll */
+ intmax_t ret = 0;
+ intmax_t max = INTMAX_MAX;
+ intmax_t min = INTMAX_MIN;
- /* if > INTMAX_MAX */
- /* errno = ERANGE; */
- /* return INTMAX_MAX */
+ #include "../stdlib/_strtoi.h"
- /* if < INTMAX_MIN */
- /* errno = ERANGE; */
- /* return INTMAX_MIN; */
-
- /* if no conversion */
- return 0;
+ return ret;
}
/*
diff --git a/src/inttypes/strtoumax.c b/src/inttypes/strtoumax.c
index bc286cc0..60aec599 100644
--- a/src/inttypes/strtoumax.c
+++ b/src/inttypes/strtoumax.c
@@ -1,15 +1,16 @@
+#include "stddef.h"
#include <inttypes.h>
+#include "errno.h"
uintmax_t strtoumax(const char *restrict nptr, char ** restrict endptr, int base)
{
- /* like strotull */
+ uintmax_t ret = 0;
+ uintmax_t max = UINTMAX_MAX;
+ uintmax_t min = 0;
- /* if > UINTMAX_MAX */
- /* errno = ERANGE; */
- /* return UINTMAX_MAX */
+ #include "../stdlib/_strtoi.h"
- /* if no conversion */
- return 0;
+ return ret;
}
/*
diff --git a/src/inttypes/wcstoimax.c b/src/inttypes/wcstoimax.c
index 12c9a850..d086ede4 100644
--- a/src/inttypes/wcstoimax.c
+++ b/src/inttypes/wcstoimax.c
@@ -1,19 +1,16 @@
+#include "stddef.h"
#include <inttypes.h>
+#include "errno.h"
intmax_t wcstoimax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
- /* like wcstoll */
+ intmax_t ret = 0;
+ intmax_t max = INTMAX_MAX;
+ intmax_t min = INTMAX_MIN;
- /* if > INTMAX_MAX */
- /* errno = ERANGE; */
- /* return INTMAX_MAX */
+ #include "../stdlib/_strtoi.h"
- /* if < INTMAX_MIN */
- /* errno = ERANGE; */
- /* return INTMAX_MIN; */
-
- /* if no conversion */
- return 0;
+ return ret;
}
/*
diff --git a/src/inttypes/wcstoumax.c b/src/inttypes/wcstoumax.c
index 8516da08..e35846ea 100644
--- a/src/inttypes/wcstoumax.c
+++ b/src/inttypes/wcstoumax.c
@@ -1,15 +1,16 @@
+#include "stddef.h"
#include <inttypes.h>
+#include "errno.h"
uintmax_t wcstoumax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
- /* like wcstoll */
+ uintmax_t ret = 0;
+ uintmax_t max = UINTMAX_MAX;
+ uintmax_t min = 0;
- /* if > UINTMAX_MAX */
- /* errno = ERANGE; */
- /* return UINTMAX_MAX */
+ #include "../stdlib/_strtoi.h"
- /* if no conversion */
- return 0;
+ return ret;
}
/*