From: Martin Mares Date: Wed, 13 Nov 2002 08:47:19 +0000 (+0000) Subject: ABS should be a macro. X-Git-Tag: v1.2.0~444 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47f18ac39a313cf213b43320557239c5d0855a11;p=thirdparty%2Fbird.git ABS should be a macro. --- diff --git a/lib/birdlib.h b/lib/birdlib.h index fc27db9b9..1904d666e 100644 --- a/lib/birdlib.h +++ b/lib/birdlib.h @@ -19,6 +19,7 @@ #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) +#define ABS(a) ((a)>=0 ? (a) : -(a)) #define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a))) #ifndef NULL diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c index 46dc707a2..cf45fd4e6 100644 --- a/proto/ospf/lsalib.c +++ b/proto/ospf/lsalib.c @@ -399,7 +399,7 @@ lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2) if((l1->age==LSA_MAXAGE)&&(l2->age!=LSA_MAXAGE)) return CMP_NEWER; if((l2->age==LSA_MAXAGE)&&(l1->age!=LSA_MAXAGE)) return CMP_OLDER; - if(abs(l1->age-l2->age)>LSA_MAXAGEDIFF) + if(ABS(l1->age-l2->age)>LSA_MAXAGEDIFF) return l1->ageage ? CMP_NEWER : CMP_OLDER; return CMP_SAME;