diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-07-05 12:32:31 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-07-05 12:32:31 +0200 |
commit | 1a913ebefbc0b8eb18c5637db81616cf7a41f0ce (patch) | |
tree | 97cd462c45f760ce0824c9152911d2cea396c3a0 | |
parent | 709595b2979d7fcbc94b57236a8dca1a5d2dd4cb (diff) | |
parent | 3fa11becc5b88b2ff2099721d0d6834ba273309e (diff) | |
download | sparse-1a913ebefbc0b8eb18c5637db81616cf7a41f0ce.tar.gz |
Merge branch 'cleanup-compat'
* remove pre-C99 compatibility layer for BSD & Solaris
-rw-r--r-- | compat-bsd.c | 14 | ||||
-rw-r--r-- | compat-solaris.c | 34 |
2 files changed, 2 insertions, 46 deletions
diff --git a/compat-bsd.c b/compat-bsd.c index d8acf40b..43c716ca 100644 --- a/compat-bsd.c +++ b/compat-bsd.c @@ -21,16 +21,4 @@ * THE SOFTWARE. */ -#include <sys/types.h> -#include <string.h> - -#include "lib.h" -#include "allocate.h" -#include "token.h" - -#include "compat/mmap-blob.c" - -long double string_to_ld(const char *nptr, char **endptr) -{ - return strtod(nptr, endptr); -} +#include "compat-linux.c" diff --git a/compat-solaris.c b/compat-solaris.c index 7253a892..58bc4338 100644 --- a/compat-solaris.c +++ b/compat-solaris.c @@ -1,33 +1 @@ -#include "lib.h" -#include "allocate.h" - -#include "compat/mmap-blob.c" - -#include <floatingpoint.h> -#include <limits.h> -#include <errno.h> - -long double string_to_ld(const char *str, char **endptr) -{ - long double res; - decimal_record dr; - enum decimal_string_form form; - decimal_mode dm; - fp_exception_field_type excp; - char *echar; - - string_to_decimal ((char **)&str, INT_MAX, 0, - &dr, &form, &echar); - if (endptr) *endptr = (char *)str; - - if (form == invalid_form) { - errno = EINVAL; - return 0.0; - } - - dm.rd = fp_nearest; - decimal_to_quadruple (&res, &dm, &dr, &excp); - if (excp & ((1 << fp_overflow) | (1 << fp_underflow))) - errno = ERANGE; - return res; -} +#include "compat-linux.c" |