summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2013-12-10 21:04:14 +0200
committerArnold D. Robbins <arnold@skeeve.com>2013-12-10 21:04:14 +0200
commit71e06c39df20400fbc04d7a3eba04700c27928f8 (patch)
tree71ea32d90dbe2af7a25f8d2dcaac8b13d32c98de
parent1edf4055bc5d91cd77228da9b2756ac8f4e7b004 (diff)
downloadgawk-71e06c39df20400fbc04d7a3eba04700c27928f8.tar.gz
Remove unneeded Floor and Ceil wrapper functions.
-rw-r--r--ChangeLog7
-rw-r--r--awk.h7
-rw-r--r--builtin.c4
-rw-r--r--floatcomp.c24
4 files changed, 11 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index a8d59898..1355d491 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-12-10 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (Floor, Ceil): Remove declarations and VMS redefinitions.
+ * floatcomp.c (Floor, Ceil): Removed, not needed. Move bracketing
+ ifdef to the top of the file.
+ * builtin.c (double_to_int): Use floor() and ceil().
+
2013-12-07 Arnold D. Robbins <arnold@skeeve.com>
* regex_internal.h (__attribute__): Define to empty if not GCC.
diff --git a/awk.h b/awk.h
index 6c6e8405..469d6b63 100644
--- a/awk.h
+++ b/awk.h
@@ -1661,13 +1661,6 @@ extern NODE **function_list(bool sort);
extern void print_vars(NODE **table, Func_print print_func, FILE *fp);
/* floatcomp.c */
-#ifdef VMS /* VMS linker weirdness? */
-#define Ceil gawk_ceil
-#define Floor gawk_floor
-#endif
-
-extern AWKNUM Floor(AWKNUM n);
-extern AWKNUM Ceil(AWKNUM n);
#ifdef HAVE_UINTMAX_T
extern uintmax_t adjust_uint(uintmax_t n);
#else
diff --git a/builtin.c b/builtin.c
index bb7050b0..7a969cbc 100644
--- a/builtin.c
+++ b/builtin.c
@@ -469,9 +469,9 @@ double
double_to_int(double d)
{
if (d >= 0)
- d = Floor(d);
+ d = floor(d);
else
- d = Ceil(d);
+ d = ceil(d);
return d;
}
diff --git a/floatcomp.c b/floatcomp.c
index 9d24a67f..16a6d88e 100644
--- a/floatcomp.c
+++ b/floatcomp.c
@@ -26,6 +26,8 @@
#include "awk.h"
#include <math.h>
+#ifdef HAVE_UINTMAX_T
+
/* Assume IEEE-754 arithmetic on pre-C89 hosts. */
#ifndef FLT_RADIX
#define FLT_RADIX 2
@@ -69,28 +71,6 @@ Please port the following code to your weird host;
#define AWKNUM_FRACTION_BITS (AWKNUM_MANT_DIG * (FLT_RADIX == 2 ? 1 : 4))
#define DBL_FRACTION_BITS (DBL_MANT_DIG * (FLT_RADIX == 2 ? 1 : 4))
-/*
- * Floor and Ceil --- Work around a problem in conversion of
- * doubles to exact integers.
- */
-
-/* Floor --- do floor(), also for Cray */
-
-AWKNUM
-Floor(AWKNUM n)
-{
- return floor(n);
-}
-
-/* Ceil --- do ceil(), also for Cray */
-
-AWKNUM
-Ceil(AWKNUM n)
-{
- return ceil(n);
-}
-
-#ifdef HAVE_UINTMAX_T
/* adjust_uint --- fiddle with values, ask Paul Eggert to explain */
uintmax_t