summaryrefslogtreecommitdiffstats
path: root/Utilities/cmxmlrpc/casprintf.c
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-02-24 01:28:21 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-02-24 01:28:21 (GMT)
commitf30e7608484d48ec9a3f3073f4b7a351a44d90a9 (patch)
tree48b306d35d39e00747cd3c32e8a6cf51c1d2ed82 /Utilities/cmxmlrpc/casprintf.c
parenta8770ccc193371d19f16bad6e4cf7ef6932a4ad5 (diff)
downloadCMake-f30e7608484d48ec9a3f3073f4b7a351a44d90a9.zip
CMake-f30e7608484d48ec9a3f3073f4b7a351a44d90a9.tar.gz
CMake-f30e7608484d48ec9a3f3073f4b7a351a44d90a9.tar.bz2
COMP: Several Windows fixes
Diffstat (limited to 'Utilities/cmxmlrpc/casprintf.c')
-rw-r--r--Utilities/cmxmlrpc/casprintf.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/Utilities/cmxmlrpc/casprintf.c b/Utilities/cmxmlrpc/casprintf.c
new file mode 100644
index 0000000..1fcc774
--- /dev/null
+++ b/Utilities/cmxmlrpc/casprintf.c
@@ -0,0 +1,35 @@
+#define _GNU_SOURCE
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "xmlrpc_config.h" /* For HAVE_ASPRINTF */
+#include "casprintf.h"
+
+void GNU_PRINTF_ATTR(2,3)
+casprintf(const char ** const retvalP, const char * const fmt, ...) {
+
+ char *retval;
+
+ va_list varargs; /* mysterious structure used by variable arg facility */
+
+ va_start(varargs, fmt); /* start up the mysterious variable arg facility */
+
+#if HAVE_ASPRINTF
+ vasprintf(&retval, fmt, varargs);
+#else
+ retval = malloc(8192);
+ vsnprintf(retval, 8192, fmt, varargs);
+#endif
+ *retvalP = retval;
+}
+
+
+
+void
+strfree(const char * const string) {
+ free((void *)string);
+}
+
+
+