* [PATCH] remove unneeded BSD & Solaris compatibility layer
@ 2020-06-28 9:09 Luc Van Oostenryck
2020-06-28 9:09 ` Luc Van Oostenryck
0 siblings, 1 reply; 2+ messages in thread
From: Luc Van Oostenryck @ 2020-06-28 9:09 UTC (permalink / raw)
To: linux-sparse; +Cc: Luc Van Oostenryck
None of the BSDs need "compat-bsd.c" anymore. Same for
Solaris and "compat-solaris.c", even for Solaris 10.
The only problem was lacking C99's strtold() but it seems
that this was solved many years ago and they're all doing
quite fine with "compat-linux.c".
So, simply replace the content of these file by an include of
"compat-linux.c".
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
compat-bsd.c | 14 +-------------
compat-solaris.c | 34 +---------------------------------
2 files changed, 2 insertions(+), 46 deletions(-)
diff --git a/compat-bsd.c b/compat-bsd.c
index d8acf40b1dcb..43c716ca2f87 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 7253a892d50d..58bc43387c60 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;
- }
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] remove unneeded BSD & Solaris compatibility layer
2020-06-28 9:09 [PATCH] remove unneeded BSD & Solaris compatibility layer Luc Van Oostenryck
@ 2020-06-28 9:09 ` Luc Van Oostenryck
0 siblings, 0 replies; 2+ messages in thread
From: Luc Van Oostenryck @ 2020-06-28 9:09 UTC (permalink / raw)
To: linux-sparse; +Cc: Luc Van Oostenryck
None of the BSDs need "compat-bsd.c" anymore. Same for
Solaris and "compat-solaris.c", even for Solaris 10.
The only problem was lacking C99's strtold() but it seems
that this was solved many years ago and they're all doing
quite fine with "compat-linux.c".
So, simply replace the content of these file by an include of
"compat-linux.c".
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
compat-bsd.c | 14 +-------------
compat-solaris.c | 34 +---------------------------------
2 files changed, 2 insertions(+), 46 deletions(-)
diff --git a/compat-bsd.c b/compat-bsd.c
index d8acf40b1dcb..43c716ca2f87 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 7253a892d50d..58bc43387c60 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"
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-28 9:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-28 9:09 [PATCH] remove unneeded BSD & Solaris compatibility layer Luc Van Oostenryck
2020-06-28 9:09 ` Luc Van Oostenryck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).