Module Name:    src
Committed By:   sborrill
Date:           Sat Mar  6 22:42:08 UTC 2010

Modified Files:
        src/dist/pf/sbin/pfctl [netbsd-5]: pfctl_altq.c
        src/gnu/dist/binutils/libiberty [netbsd-5]: floatformat.c
        src/gnu/dist/gcc4/libiberty [netbsd-5]: floatformat.c
        src/gnu/dist/gdb6/libiberty [netbsd-5]: floatformat.c
        src/usr.sbin/altq/libaltq [netbsd-5]: qop_hfsc.c

Log Message:
Pull up the following revisions(s) (requested by joerg in ticket #1328):
        usr.sbin/altq/libaltq/qop_hfsc.c:       revision 1.9
        dist/pf/sbin/pfctl/pfctl_altq.c:        revision 1.9
        gnu/dist/binutils/libiberty/floatformat.c:      patch
        gnu/dist/gcc4/libiberty/floatformat.c:  revision 1.2
        gnu/dist/gdb6/libiberty/floatformat.c:  revision 1.2

Fix standard-violating use of INFINITY in build of NetBSD/vax.
Use HUGE_VAL instead of INFINITY as positive infinity (or maximum value)
is good enough and the side effects of ISO C99 7.12 (4) are not desired.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.4.1 src/dist/pf/sbin/pfctl/pfctl_altq.c
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.32.1 \
    src/gnu/dist/binutils/libiberty/floatformat.c
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.26.1 \
    src/gnu/dist/gcc4/libiberty/floatformat.c
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.26.1 \
    src/gnu/dist/gdb6/libiberty/floatformat.c
cvs rdiff -u -r1.8 -r1.8.24.1 src/usr.sbin/altq/libaltq/qop_hfsc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/dist/pf/sbin/pfctl/pfctl_altq.c
diff -u src/dist/pf/sbin/pfctl/pfctl_altq.c:1.8 src/dist/pf/sbin/pfctl/pfctl_altq.c:1.8.4.1
--- src/dist/pf/sbin/pfctl/pfctl_altq.c:1.8	Wed Jun 18 09:06:26 2008
+++ src/dist/pf/sbin/pfctl/pfctl_altq.c	Sat Mar  6 22:42:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfctl_altq.c,v 1.8 2008/06/18 09:06:26 yamt Exp $	*/
+/*	$NetBSD: pfctl_altq.c,v 1.8.4.1 2010/03/06 22:42:08 sborrill Exp $	*/
 /*	$OpenBSD: pfctl_altq.c,v 1.92 2007/05/27 05:15:17 claudio Exp $	*/
 
 /*
@@ -881,9 +881,6 @@
 /*
  * admission control using generalized service curve
  */
-#ifndef __NetBSD__
-#define	INFINITY	HUGE_VAL  /* positive infinity defined in <math.h> */
-#endif /* !__NetBSD__ */
 
 /* add a new service curve to a generalized service curve */
 static void
@@ -893,7 +890,7 @@
 		return;
 	if (sc->d != 0)
 		gsc_add_seg(gsc, 0.0, 0.0, (double)sc->d, (double)sc->m1);
-	gsc_add_seg(gsc, (double)sc->d, 0.0, INFINITY, (double)sc->m2);
+	gsc_add_seg(gsc, (double)sc->d, 0.0, HUGE_VAL, (double)sc->m2);
 }
 
 /*
@@ -917,10 +914,10 @@
 		return (1);
 	}
 	/*
-	 * gsc has a dummy entry at the end with x = INFINITY.
+	 * gsc has a dummy entry at the end with x = HUGE_VAL.
 	 * loop through up to this dummy entry.
 	 */
-	end = gsc_getentry(gsc, INFINITY);
+	end = gsc_getentry(gsc, HUGE_VAL);
 	if (end == NULL)
 		return (1);
 	last = NULL;
@@ -977,10 +974,10 @@
 		return (NULL);
 
 	new->x = x;
-	if (x == INFINITY || s == NULL)
+	if (x == HUGE_VAL || s == NULL)
 		new->d = 0;
-	else if (s->x == INFINITY)
-		new->d = INFINITY;
+	else if (s->x == HUGE_VAL)
+		new->d = HUGE_VAL;
 	else
 		new->d = s->x - x;
 	if (prev == NULL) {
@@ -993,12 +990,12 @@
 		 * the start point intersects with the segment pointed by
 		 * prev.  divide prev into 2 segments
 		 */
-		if (x == INFINITY) {
-			prev->d = INFINITY;
+		if (x == HUGE_VAL) {
+			prev->d = HUGE_VAL;
 			if (prev->m == 0)
 				new->y = prev->y;
 			else
-				new->y = INFINITY;
+				new->y = HUGE_VAL;
 		} else {
 			prev->d = x - prev->x;
 			new->y = prev->d * prev->m + prev->y;
@@ -1016,8 +1013,8 @@
 	struct segment	*start, *end, *s;
 	double		 x2;
 
-	if (d == INFINITY)
-		x2 = INFINITY;
+	if (d == HUGE_VAL)
+		x2 = HUGE_VAL;
 	else
 		x2 = x + d;
 	start = gsc_getentry(gsc, x);
@@ -1030,7 +1027,7 @@
 		s->y += y + (s->x - x) * m;
 	}
 
-	end = gsc_getentry(gsc, INFINITY);
+	end = gsc_getentry(gsc, HUGE_VAL);
 	for (; s != end; s = LIST_NEXT(s, _next)) {
 		s->y += m * d;
 	}

Index: src/gnu/dist/binutils/libiberty/floatformat.c
diff -u src/gnu/dist/binutils/libiberty/floatformat.c:1.1.1.2 src/gnu/dist/binutils/libiberty/floatformat.c:1.1.1.2.32.1
--- src/gnu/dist/binutils/libiberty/floatformat.c:1.1.1.2	Wed Dec  8 09:11:51 2004
+++ src/gnu/dist/binutils/libiberty/floatformat.c	Sat Mar  6 22:42:08 2010
@@ -318,7 +318,11 @@
       if (nan)
 	dto = NAN;
       else
+#ifdef __vax__
+	dto = HUGE_VAL;
+#else
 	dto = INFINITY;
+#endif
 
       if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
 	dto = -dto;

Index: src/gnu/dist/gcc4/libiberty/floatformat.c
diff -u src/gnu/dist/gcc4/libiberty/floatformat.c:1.1.1.1 src/gnu/dist/gcc4/libiberty/floatformat.c:1.1.1.1.26.1
--- src/gnu/dist/gcc4/libiberty/floatformat.c:1.1.1.1	Thu Apr 20 09:59:34 2006
+++ src/gnu/dist/gcc4/libiberty/floatformat.c	Sat Mar  6 22:42:08 2010
@@ -351,7 +351,11 @@
       if (nan)
 	dto = NAN;
       else
+#ifdef __vax__
+	dto = HUGE_VAL;
+#else
 	dto = INFINITY;
+#endif
 
       if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
 	dto = -dto;

Index: src/gnu/dist/gdb6/libiberty/floatformat.c
diff -u src/gnu/dist/gdb6/libiberty/floatformat.c:1.1.1.2 src/gnu/dist/gdb6/libiberty/floatformat.c:1.1.1.2.26.1
--- src/gnu/dist/gdb6/libiberty/floatformat.c:1.1.1.2	Sun Jul  2 20:21:43 2006
+++ src/gnu/dist/gdb6/libiberty/floatformat.c	Sat Mar  6 22:42:08 2010
@@ -351,7 +351,11 @@
       if (nan)
 	dto = NAN;
       else
+#ifdef __vax__
+	dto = HUGE_VAL;
+#else
 	dto = INFINITY;
+#endif
 
       if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
 	dto = -dto;

Index: src/usr.sbin/altq/libaltq/qop_hfsc.c
diff -u src/usr.sbin/altq/libaltq/qop_hfsc.c:1.8 src/usr.sbin/altq/libaltq/qop_hfsc.c:1.8.24.1
--- src/usr.sbin/altq/libaltq/qop_hfsc.c:1.8	Thu Oct 12 19:59:13 2006
+++ src/usr.sbin/altq/libaltq/qop_hfsc.c	Sat Mar  6 22:42:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: qop_hfsc.c,v 1.8 2006/10/12 19:59:13 peter Exp $	*/
+/*	$NetBSD: qop_hfsc.c,v 1.8.24.1 2010/03/06 22:42:08 sborrill Exp $	*/
 /*	$KAME: qop_hfsc.c,v 1.12 2005/01/05 04:53:47 itojun Exp $	*/
 /*
  * Copyright (C) 1999-2000
@@ -753,9 +753,6 @@
 /*
  * admission control using generalized service curve
  */
-#ifndef INFINITY
-#define	INFINITY	HUGE_VAL  /* positive infinity defined in <math.h> */
-#endif
 
 /* add a new service curve to a generilized service curve */
 static void
@@ -765,7 +762,7 @@
 		return;
 	if (sc->d != 0)
 		gsc_add_seg(gsc, 0, 0, (double)sc->d, (double)sc->m1);
-	gsc_add_seg(gsc, (double)sc->d, 0, INFINITY, (double)sc->m2);
+	gsc_add_seg(gsc, (double)sc->d, 0, HUGE_VAL, (double)sc->m2);
 }
 
 /* subtract a service curve from a generilized service curve */
@@ -776,7 +773,7 @@
 		return;
 	if (sc->d != 0)
 		gsc_sub_seg(gsc, 0, 0, (double)sc->d, (double)sc->m1);
-	gsc_sub_seg(gsc, (double)sc->d, 0, INFINITY, (double)sc->m2);
+	gsc_sub_seg(gsc, (double)sc->d, 0, HUGE_VAL, (double)sc->m2);
 }
 
 /*
@@ -800,10 +797,10 @@
 		return (1);
 	}
 	/*
-	 * gsc has a dummy entry at the end with x = INFINITY.
+	 * gsc has a dummy entry at the end with x = HUGE_VAL.
 	 * loop through up to this dummy entry.
 	 */
-	end = gsc_getentry(gsc, INFINITY);
+	end = gsc_getentry(gsc, HUGE_VAL);
 	if (end == NULL)
 		return (1);
 	last = NULL;
@@ -860,10 +857,10 @@
 		return (NULL);
 
 	new->x = x;
-	if (x == INFINITY || s == NULL)
+	if (x == HUGE_VAL || s == NULL)
 		new->d = 0;
-	else if (s->x == INFINITY)
-		new->d = INFINITY;
+	else if (s->x == HUGE_VAL)
+		new->d = HUGE_VAL;
 	else
 		new->d = s->x - x;
 	if (prev == NULL) {
@@ -876,12 +873,12 @@
 		 * the start point intersects with the segment pointed by
 		 * prev.  divide prev into 2 segments
 		 */
-		if (x == INFINITY) {
-			prev->d = INFINITY;
+		if (x == HUGE_VAL) {
+			prev->d = HUGE_VAL;
 			if (prev->m == 0)
 				new->y = prev->y;
 			else
-				new->y = INFINITY;
+				new->y = HUGE_VAL;
 		} else {
 			prev->d = x - prev->x;
 			new->y = prev->d * prev->m + prev->y;
@@ -899,8 +896,8 @@
 	struct segment *start, *end, *s;
 	double x2;
 
-	if (d == INFINITY)
-		x2 = INFINITY;
+	if (d == HUGE_VAL)
+		x2 = HUGE_VAL;
 	else
 		x2 = x + d;
 	start = gsc_getentry(gsc, x);
@@ -913,7 +910,7 @@
 		s->y += y + (s->x - x) * m;
 	}
 
-	end = gsc_getentry(gsc, INFINITY);
+	end = gsc_getentry(gsc, HUGE_VAL);
 	for (; s != end; s = LIST_NEXT(s, _next)) {
 		s->y += m * d;
 	}
@@ -962,7 +959,7 @@
 			goto again;
 		} else if (s->m == next->m) {
 			/* join the two entries */
-			if (s->d != INFINITY && next->d != INFINITY)
+			if (s->d != HUGE_VAL && next->d != HUGE_VAL)
 				s->d += next->d;
 			LIST_REMOVE(next, _next);
 			free(next);

Reply via email to