From 768451c5e3a9e8458ed646f965a9f091de6a4512 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 17 Mar 2011 22:56:17 -0400 Subject: lib/dload.c: fix compiler warnings generated by -Wfloat-equal * introduces new macro in util.h (DOUBLE_EQ) for properly comparing floating point values Signed-off-by: Dave Reisner Signed-off-by: Dan McGee --- lib/libalpm/util.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/libalpm/util.h') diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index 9f0344fe..1816e360 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -36,6 +36,8 @@ #include #include /* struct stat */ #include /* struct archive */ +#include /* fabs */ +#include /* DBL_EPSILON */ #ifdef ENABLE_NLS #include /* here so it doesn't need to be included elsewhere */ @@ -61,6 +63,8 @@ _alpm_log(PM_LOG_DEBUG, "returning error %d from %s : %s\n", err, __func__, alpm_strerrorlast()); \ return (ret); } while(0) +#define DOUBLE_EQ(x, y) (fabs((x) - (y)) < DBL_EPSILON) + /** * Used as a buffer/state holder for _alpm_archive_fgets(). */ -- cgit v1.2.3-24-g4f1b