summaryrefslogtreecommitdiff
path: root/src/port
diff options
context:
space:
mode:
authorThomas Munro2022-08-07 00:42:11 +0000
committerThomas Munro2022-08-07 00:42:41 +0000
commitcbf4403134738245db48b306c62eb1258f2b2bd0 (patch)
tree8701627bd54d0a1fc23ac0180dc3608d019044f5 /src/port
parent24c3ce8f1c707f9eeb1f68cebd44c2516ff799c2 (diff)
Simplify replacement code for strtof.
strtof() is in C99 and all targeted systems have it. We can remove the configure probe and some dead code, but we still need replacement code for a couple of systems that have known buggy implementations selected via platform template. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/152683.1659830125%40sss.pgh.pa.us
Diffstat (limited to 'src/port')
-rw-r--r--src/port/strtof.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/port/strtof.c b/src/port/strtof.c
index 314fcc9851f..21b3f8f7122 100644
--- a/src/port/strtof.c
+++ b/src/port/strtof.c
@@ -16,43 +16,7 @@
#include <float.h>
#include <math.h>
-#ifndef HAVE_STRTOF
-/*
- * strtof() is part of C99; this version is only for the benefit of obsolete
- * platforms. As such, it is known to return incorrect values for edge cases,
- * which have to be allowed for in variant files for regression test results
- * for any such platform.
- */
-
-float
-strtof(const char *nptr, char **endptr)
-{
- int caller_errno = errno;
- double dresult;
- float fresult;
-
- errno = 0;
- dresult = strtod(nptr, endptr);
- fresult = (float) dresult;
- if (errno == 0)
- {
- /*
- * Value might be in-range for double but not float.
- */
- if (dresult != 0 && fresult == 0)
- caller_errno = ERANGE; /* underflow */
- if (!isinf(dresult) && isinf(fresult))
- caller_errno = ERANGE; /* overflow */
- }
- else
- caller_errno = errno;
-
- errno = caller_errno;
- return fresult;
-}
-
-#elif HAVE_BUGGY_STRTOF
/*
* Cygwin has a strtof() which is literally just (float)strtod(), which means
* we can't avoid the double-rounding problem; but using this wrapper does get
@@ -119,5 +83,3 @@ pg_strtof(const char *nptr, char **endptr)
}
}
}
-
-#endif