logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0007-Avoid-use-of-long-double.patch (1552B)


  1. From 7a6a46d6811acd06661f4f3f2e36d69157b695bf Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Mon, 6 Sep 2021 18:05:22 -0700
  4. Subject: [PATCH] Avoid use of long double
  5. ---
  6. lib/strutils.c | 10 ++++++----
  7. 1 file changed, 6 insertions(+), 4 deletions(-)
  8. diff --git a/lib/strutils.c b/lib/strutils.c
  9. index 54746fcae..efadd67ff 100644
  10. --- a/lib/strutils.c
  11. +++ b/lib/strutils.c
  12. @@ -456,6 +456,7 @@ err:
  13. errx(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str);
  14. }
  15. +#if 0
  16. int ul_strtold(const char *str, long double *num)
  17. {
  18. char *end = NULL;
  19. @@ -483,6 +484,7 @@ long double strtold_or_err(const char *str, const char *errmesg)
  20. errx(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str);
  21. }
  22. +#endif
  23. uintmax_t strtosize_or_err(const char *str, const char *errmesg)
  24. {
  25. @@ -500,18 +502,18 @@ uintmax_t strtosize_or_err(const char *str, const char *errmesg)
  26. void strtotimeval_or_err(const char *str, struct timeval *tv, const char *errmesg)
  27. {
  28. - long double user_input;
  29. + double user_input;
  30. - user_input = strtold_or_err(str, errmesg);
  31. + user_input = strtod_or_err(str, errmesg);
  32. tv->tv_sec = (time_t) user_input;
  33. tv->tv_usec = (suseconds_t)((user_input - tv->tv_sec) * 1000000);
  34. }
  35. void strtotimespec_or_err(const char *str, struct timespec *ts, const char *errmesg)
  36. {
  37. - long double user_input;
  38. + double user_input;
  39. - user_input = strtold_or_err(str, errmesg);
  40. + user_input = strtod_or_err(str, errmesg);
  41. ts->tv_sec = (time_t) user_input;
  42. ts->tv_nsec = (long)((user_input - ts->tv_sec) * 1000000000);
  43. }
  44. --
  45. 2.49.0