Index: ossp-pkg/str/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/str/ChangeLog,v rcsdiff -q -kk '-r1.46' '-r1.47' -u '/v/ossp/cvs/ossp-pkg/str/ChangeLog,v' 2>/dev/null --- ChangeLog 2004/04/23 09:30:36 1.46 +++ ChangeLog 2004/04/23 10:03:09 1.47 @@ -9,6 +9,15 @@ ChangeLog + Changes between 0.9.8 and 0.9.9 (17-Feb-2003 to 23-Apr-2004): + + *) Import change introduced in OSSP l2 0.9.7: + Replace modf(3) calls in str_format.c with a hand-crafted + inlined str_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.7 and 0.9.8 (01-Apr-2002 to 17-Feb-2003): *) Added @DEFS@ to $(CFLAGS) in Makefile.in to correctly see things Index: ossp-pkg/str/configure.ac RCS File: /v/ossp/cvs/ossp-pkg/str/configure.ac,v rcsdiff -q -kk '-r1.12' '-r1.13' -u '/v/ossp/cvs/ossp-pkg/str/configure.ac,v' 2>/dev/null --- configure.ac 2003/01/06 19:13:47 1.12 +++ configure.ac 2004/04/23 10:03:09 1.13 @@ -29,8 +29,6 @@ AC_HAVE_FUNCS(memmove memset memcmp memchr) AC_HAVE_FUNCS(isnan isinf) -AC_CHECK_FUNC(modf, , AC_CHECK_LIB(m, modf)) - AC_CHECK_EXTLIB([Dmalloc], dmalloc, dmalloc_debug, dmalloc.h, [AC_DEFINE(WITH_DMALLOC, 1, [Define to 1 if building with Dmalloc])]) Index: ossp-pkg/str/str_format.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_format.c,v rcsdiff -q -kk '-r1.28' '-r1.29' -u '/v/ossp/cvs/ossp-pkg/str/str_format.c,v' 2>/dev/null --- str_format.c 2003/01/06 19:13:47 1.28 +++ str_format.c 2004/04/23 10:03:09 1.29 @@ -134,6 +134,25 @@ #define str_fcvt(arg,ndigits,decpt,sign,buf) \ str_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 +str_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 * str_cvt( double arg, @@ -156,14 +175,14 @@ *sign = TRUE; arg = -arg; } - arg = modf(arg, &fi); + arg = str_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 = str_modf(fi / 10, &fi); *--p1 = (int)((fj + .03) * 10) + '0'; r2++; } @@ -186,7 +205,7 @@ } while (p <= p1 && p < &buf[NDIG]) { arg *= 10; - arg = modf(arg, &fj); + arg = str_modf(arg, &fj); *p++ = (int) fj + '0'; } if (p1 >= &buf[NDIG]) { Index: ossp-pkg/str/str_p.h RCS File: /v/ossp/cvs/ossp-pkg/str/str_p.h,v rcsdiff -q -kk '-r1.21' '-r1.22' -u '/v/ossp/cvs/ossp-pkg/str/str_p.h,v' 2>/dev/null --- str_p.h 2003/01/06 19:13:47 1.21 +++ str_p.h 2004/04/23 10:03:09 1.22 @@ -35,7 +35,6 @@ #endif #include /* for malloc, etc. */ -#include /* for modf(3) */ #include /* ... */ #include "str.h"