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