Index: ossp-pkg/cfg/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/cfg/ChangeLog,v rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/cfg/ChangeLog,v' 2>/dev/null --- ChangeLog 2003/11/10 19:15:54 1.7 +++ ChangeLog 2004/04/23 10:05:58 1.8 @@ -8,6 +8,15 @@ CHANGELOG + Changes between 0.9.2 and 0.9.3 (10-Nov-2003 to 23-Apr-2004): + + *) Import change introduced in OSSP l2 0.9.7: + Replace modf(3) calls in cfg_fmt.c with a hand-crafted + inlined cfg_fmt_modf() function to avoid dependency to external + libm on systems where modf(3) is not part of libc, i.e. Tru64 and + QNX. Reported by Karl Vogel. + [Thomas Lotterer ] + Changes between 0.9.1 and 0.9.2 (10-Nov-2003 to 10-Nov-2003) *) Upgraded build environment to GNU libtool 1.5 and Index: ossp-pkg/cfg/cfg_fmt.c RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg_fmt.c,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg_fmt.c,v' 2>/dev/null --- cfg_fmt.c 2003/01/06 11:17:43 1.4 +++ cfg_fmt.c 2004/04/23 10:05:58 1.5 @@ -96,7 +96,6 @@ #include #include #include -#include #include "cfg_fmt.h" @@ -162,6 +161,25 @@ #define cfg_fmt_fcvt(arg,ndigits,decpt,sign,buf) \ cfg_fmt_cvt((arg), (ndigits), (decpt), (sign), 0, (buf)) +/* inlined modf(3) to avoid dependency to external libm on systems + (like Tru64, QNX, etc) where modf(3) is not part of libc. */ +static double +cfg_fmt_modf( + double arg, + double *iptr) +{ + double fraction; + double integral; + long trunc; + + trunc = (long)arg; + integral = (double)trunc; + fraction = arg - integral; + if (iptr != NULL) + *iptr = integral; + return fraction; +} + static char * cfg_fmt_cvt( double arg, @@ -184,14 +202,14 @@ *sign = TRUE; arg = -arg; } - arg = modf(arg, &fi); + arg = cfg_fmt_modf(arg, &fi); p1 = &buf[NDIG]; /* Do integer part */ if (fi != 0) { p1 = &buf[NDIG]; while (fi != 0 && p1 > &buf[0]) { - fj = modf(fi / 10, &fi); + fj = cfg_fmt_modf(fi / 10, &fi); *--p1 = (int)((fj + .03) * 10) + '0'; r2++; } @@ -214,7 +232,7 @@ } while (p <= p1 && p < &buf[NDIG]) { arg *= 10; - arg = modf(arg, &fj); + arg = cfg_fmt_modf(arg, &fj); *p++ = (int) fj + '0'; } if (p1 >= &buf[NDIG]) {