[m-dev.] for review: detect _vsnprintf

Peter Ross peter.ross at miscrit.be
Thu Aug 10 20:45:11 AEST 2000


Hi,


===================================================================


Estimated hours taken: 0.5

Check for the availability of _vsnprintf.

configure.in:
	Check for the availability of _vsnprintf.

runtime/mercury_conf.h.in:
	Define HAVE__VSNPRINTF.

runtime/mercury_string.c:
	If vsnprintf isn't available and _vsnprintf is, use _vsnprintf
	in place of vsnprintf.


Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.215
diff -u -r1.215 configure.in
--- configure.in	2000/08/10 09:01:14	1.215
+++ configure.in	2000/08/10 10:41:29
@@ -297,7 +297,7 @@
 esac
 AC_HAVE_FUNCS(sysconf getpagesize memalign mprotect sigaction setitimer)
 AC_HAVE_FUNCS(strerror memmove fileno fdopen fstat)
-AC_HAVE_FUNCS(vsnprintf)
+AC_HAVE_FUNCS(vsnprintf _vsnprintf)
 #-----------------------------------------------------------------------------#
 AC_CHECK_HEADER(unistd.h, HAVE_UNISTD_H=1)
 if test "$HAVE_UNISTD_H" = 1; then
Index: runtime/mercury_conf.h.in
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_conf.h.in,v
retrieving revision 1.29
diff -u -r1.29 mercury_conf.h.in
--- runtime/mercury_conf.h.in	2000/08/10 09:01:17	1.29
+++ runtime/mercury_conf.h.in	2000/08/10 10:41:35
@@ -140,6 +140,7 @@
 ** system call is available:
 **
 **	HAVE_VSNPRINTF 		we have the vsnprintf() function.
+**	HAVE__VSNPRINTF 	we have the _vsnprintf() function.
 **	HAVE_SYSCONF     	we have the sysconf() system call.
 **	HAVE_SIGACTION		we have the sigaction() system call.
 **	HAVE_GETPAGESIZE 	we have the getpagesize() system call.
@@ -160,6 +161,7 @@
 **				#if defined(fileno) || defined(HAVE_FILENO)
 */
 #undef	HAVE_VSNPRINTF
+#undef	HAVE__VSNPRINTF
 #undef	HAVE_SYSCONF
 #undef	HAVE_SIGACTION
 #undef	HAVE_GETPAGESIZE
Index: runtime/mercury_string.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_string.c,v
retrieving revision 1.4
diff -u -r1.4 mercury_string.c
--- runtime/mercury_string.c	2000/08/10 09:37:32	1.4
+++ runtime/mercury_string.c	2000/08/10 10:41:39
@@ -9,13 +9,17 @@
 #include "mercury_imp.h"
 #include "mercury_string.h"
 
+#if defined(HAVE__VSNPRINTF) && ! defined(HAVE_VSNPRINTF)
+  #define vsnprintf	_vsnprintf
+#endif
+
 MR_String
 MR_make_string(MR_Code *proclabel, const char *fmt, ...) {
 	va_list		ap;
 	MR_String	result;
 	int 		n;
 
-#ifdef HAVE_VSNPRINTF
+#if defined(HAVE_VSNPRINTF) || defined(HAVE__VSNPRINTF)
 	/* Guess that 100 bytes should be sufficient */
 	int 		size = 100;
 	char		*p;

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list