diff options
| author | Jakob Kaivo <jkk@ung.org> | 2024-01-30 13:15:59 -0500 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2024-01-30 13:15:59 -0500 |
| commit | 608008917d26e7b2f6d0e1041ab981c853fe9733 (patch) | |
| tree | 89b3943cea54b5b1b7addadf10951a08d21653d2 /src/inttypes | |
| parent | 46e4b9b12ec7d170691c2cb05970d6537633fa71 (diff) | |
update standards and safety checks
Diffstat (limited to 'src/inttypes')
| -rw-r--r-- | src/inttypes/imaxabs.c | 10 | ||||
| -rw-r--r-- | src/inttypes/imaxdiv.c | 10 | ||||
| -rw-r--r-- | src/inttypes/strtoimax.c | 9 | ||||
| -rw-r--r-- | src/inttypes/strtoumax.c | 10 | ||||
| -rw-r--r-- | src/inttypes/wcstoimax.c | 9 | ||||
| -rw-r--r-- | src/inttypes/wcstoumax.c | 9 |
6 files changed, 25 insertions, 32 deletions
diff --git a/src/inttypes/imaxabs.c b/src/inttypes/imaxabs.c index 7f4e22ae..28f82987 100644 --- a/src/inttypes/imaxabs.c +++ b/src/inttypes/imaxabs.c @@ -1,12 +1,13 @@ -#if 0 - -#include <stddef.h> #include <inttypes.h> +#include "_safety.h" +#undef imaxabs /** absolute value **/ intmax_t imaxabs(intmax_t j) { + SIGNAL_SAFE(0); + if (j == INTMAX_MIN) { /* undefined behavior */ return INTMAX_MIN; @@ -24,6 +25,3 @@ UNDEFINED(ABS(ARGUMENT(j)) cannot be represented RETURN_SUCCESS(ABS(ARGUMENT(j)) STDC(199901) */ - - -#endif diff --git a/src/inttypes/imaxdiv.c b/src/inttypes/imaxdiv.c index ee318996..4c1c7a70 100644 --- a/src/inttypes/imaxdiv.c +++ b/src/inttypes/imaxdiv.c @@ -1,12 +1,13 @@ -#if 0 - -#include <stddef.h> #include <inttypes.h> +#include "_safety.h" +#undef imaxdiv /** calculate quotient and remainder **/ imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom) { + SIGNAL_SAFE(0); + imaxdiv_t r; r.quot = numer / denom; r.rem = numer % denom; @@ -23,6 +24,3 @@ UNDEFINED(The result cannot be represented) RETURN_SUCCESS(a TYPEDEF(ldiv_t) containing both the quotient and remainder) STDC(199901) */ - - -#endif diff --git a/src/inttypes/strtoimax.c b/src/inttypes/strtoimax.c index 4c8db326..4d66558b 100644 --- a/src/inttypes/strtoimax.c +++ b/src/inttypes/strtoimax.c @@ -1,12 +1,14 @@ -#if 0 - #include <stddef.h> #include <ctype.h> #include <errno.h> #include <inttypes.h> +#include "_safety.h" +#undef strtoimax intmax_t strtoimax(const char * restrict nptr, char ** restrict endptr, int base) { + SIGNAL_SAFE(0); + intmax_t ret = 0; intmax_t max = INTMAX_MAX; intmax_t min = INTMAX_MIN; @@ -19,6 +21,3 @@ intmax_t strtoimax(const char * restrict nptr, char ** restrict endptr, int base /* STDC(199901) */ - - -#endif diff --git a/src/inttypes/strtoumax.c b/src/inttypes/strtoumax.c index 25dca76c..28fce88b 100644 --- a/src/inttypes/strtoumax.c +++ b/src/inttypes/strtoumax.c @@ -1,12 +1,15 @@ -#if 0 - #include <stddef.h> #include <ctype.h> #include <errno.h> #include <inttypes.h> +#include "_safety.h" + +#undef strtoumax uintmax_t strtoumax(const char *restrict nptr, char ** restrict endptr, int base) { + SIGNAL_SAFE(0); + uintmax_t ret = 0; uintmax_t max = UINTMAX_MAX; uintmax_t min = 0; @@ -19,6 +22,3 @@ uintmax_t strtoumax(const char *restrict nptr, char ** restrict endptr, int base /* STDC(199901) */ - - -#endif diff --git a/src/inttypes/wcstoimax.c b/src/inttypes/wcstoimax.c index 8ab9734c..98c1636e 100644 --- a/src/inttypes/wcstoimax.c +++ b/src/inttypes/wcstoimax.c @@ -1,14 +1,16 @@ -#if 0 - #include <stddef.h> #include <errno.h> #include <inttypes.h> #include <wctype.h> +#include "_safety.h" +#undef wcstoimax #define isspace iswspace intmax_t wcstoimax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base) { + SIGNAL_SAFE(0); + intmax_t ret = 0; intmax_t max = INTMAX_MAX; intmax_t min = INTMAX_MIN; @@ -21,6 +23,3 @@ intmax_t wcstoimax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, in /* STDC(199901) */ - - -#endif diff --git a/src/inttypes/wcstoumax.c b/src/inttypes/wcstoumax.c index f19ab877..57140024 100644 --- a/src/inttypes/wcstoumax.c +++ b/src/inttypes/wcstoumax.c @@ -1,14 +1,16 @@ -#if 0 - #include <stddef.h> #include <errno.h> #include <inttypes.h> #include <wctype.h> +#include "_safety.h" +#undef wcstoumax #define isspace iswspace uintmax_t wcstoumax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base) { + SIGNAL_SAFE(0); + uintmax_t ret = 0; uintmax_t max = UINTMAX_MAX; uintmax_t min = 0; @@ -21,6 +23,3 @@ uintmax_t wcstoumax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, i /* STDC(199901) */ - - -#endif |
