apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@ebuilt.com>
Subject isnan and isinf declarations...
Date Fri, 27 Apr 2001 17:29:45 GMT
Not everyone has these functions (Solaris doesn't have isinf).  Configure 
script and appropriate logic included.  I'm not sure where the best place 
to put the AC_CHECK_FUNCS calls - "library functions" seems decent.  

Since the format can be done in a loop, s needs to be set to NULL before
checking.  You could also do the check against s_len.  -- justin

Index: configure.in
===================================================================
RCS file: /home/cvspublic/apr/configure.in,v
retrieving revision 1.293
diff -u -r1.293 configure.in
--- configure.in	2001/04/19 07:18:39	1.293
+++ configure.in	2001/04/27 17:23:16
@@ -390,7 +390,7 @@
 
 dnl #----------------------------- Checks for Any required Functions
 dnl Checks for library functions. (N.B. poll is further down)
-AC_CHECK_FUNCS(strcasecmp stricmp setsid nl_langinfo)
+AC_CHECK_FUNCS(strcasecmp stricmp setsid nl_langinfo isinf isnan)
 AC_CHECK_FUNCS(setrlimit, [ have_setrlimit="1" ], [ have_setrlimit="0" ]) 
 AC_CHECK_FUNCS(getrlimit, [ have_getrlimit="1" ], [ have_getrlimit="0" ]) 
 AC_CHECK_FUNCS(writev)
Index: strings/apr_snprintf.c
===================================================================
RCS file: /home/cvspublic/apr/strings/apr_snprintf.c,v
retrieving revision 1.13
diff -u -r1.13 apr_snprintf.c
--- strings/apr_snprintf.c	2001/04/27 13:01:59	1.13
+++ strings/apr_snprintf.c	2001/04/27 17:23:16
@@ -952,17 +952,22 @@
 	    case 'E':
 		fp_num = va_arg(ap, double);
 		/*
-		 * * We use &num_buf[ 1 ], so that we have room for the sign
+		 * We use &num_buf[ 1 ], so that we have room for the sign
 		 */
+        s = NULL;
+#ifdef HAVE_ISNAN
 		if (isnan(fp_num)) {
 		    s = "nan";
 		    s_len = 3;
 		}
-		else if (isinf(fp_num)) {
+#endif
+#ifdef HAVE_ISINF
+		if (!s && isinf(fp_num)) {
 		    s = "inf";
 		    s_len = 3;
 		}
-		else {
+#endif
+	    if (!s) {
 		    s = conv_fp(*fmt, fp_num, alternate_form,
 			    (adjust_precision == NO) ? FLOAT_DIGITS : precision,
 				&is_negative, &num_buf[1], &s_len);


Mime
View raw message