diff options
author | Dave Reisner <d@falconindy.com> | 2011-03-18 03:56:17 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-03-23 09:43:53 +0100 |
commit | 768451c5e3a9e8458ed646f965a9f091de6a4512 (patch) | |
tree | f82ae2116f280626b8d21ed680c34b4678af13e5 /lib/libalpm/util.h | |
parent | db49c4a7f0145bd25ca570f23875065041d13aa4 (diff) | |
download | pacman-768451c5e3a9e8458ed646f965a9f091de6a4512.tar.gz pacman-768451c5e3a9e8458ed646f965a9f091de6a4512.tar.xz |
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 <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.h')
-rw-r--r-- | lib/libalpm/util.h | 4 |
1 files changed, 4 insertions, 0 deletions
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 <time.h> #include <sys/stat.h> /* struct stat */ #include <archive.h> /* struct archive */ +#include <math.h> /* fabs */ +#include <float.h> /* DBL_EPSILON */ #ifdef ENABLE_NLS #include <libintl.h> /* 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(). */ |