summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2002-11-04 17:04:59 +0000
committerDaniel Veillard <veillard@src.gnome.org>2002-11-04 17:04:59 +0000
commitd7627fbf78ee906051ad54247b49c8da12fcc3a4 (patch)
tree850761843de47bd9f8d21a0125947d2eb283d7f1
parent272ea49e696bda73557d3a8337201e08aefe00f1 (diff)
downloadlibxslt-d7627fbf78ee906051ad54247b49c8da12fcc3a4.tar.gz
libxslt-d7627fbf78ee906051ad54247b49c8da12fcc3a4.tar.bz2
libxslt-d7627fbf78ee906051ad54247b49c8da12fcc3a4.zip
remove the use of snprintf, and use libxml2 string API instead. try to
* xsltproc/xsltproc.c: remove the use of snprintf, and use libxml2 string API instead. * configure.in libxslt/xsltconfig.h.in libxslt/xsltutils.c: try to cope with architecture lacking some of the string functions, reuse the trio ones compiled in libxml2 , should close #97113 Daniel
-rw-r--r--ChangeLog8
-rw-r--r--config.h.in24
-rw-r--r--configure.in15
-rw-r--r--libxslt/xsltconfig.h.in12
-rw-r--r--libxslt/xsltutils.c4
-rw-r--r--xsltproc/xsltproc.c6
6 files changed, 66 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 635abfd2..1a95c7ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Nov 4 06:55:36 CET 2002 Daniel Veillard <daniel@veillard.com>
+
+ * xsltproc/xsltproc.c: remove the use of snprintf, and use
+ libxml2 string API instead.
+ * configure.in libxslt/xsltconfig.h.in libxslt/xsltutils.c:
+ try to cope with architecture lacking some of the string functions,
+ reuse the trio ones compiled in libxml2 , should close #97113
+
Wed Oct 23 17:06:24 CEST 2002 Daniel Veillard <daniel@veillard.com>
* Makefile.am libxslt.spec.in doc/Makefile.am: cleaned up
diff --git a/config.h.in b/config.h.in
index bd8456bf..d7f6ba85 100644
--- a/config.h.in
+++ b/config.h.in
@@ -18,6 +18,9 @@
/* Define to 1 if you have the <float.h> header file. */
#undef HAVE_FLOAT_H
+/* Define to 1 if you have the `fprintf' function. */
+#undef HAVE_FPRINTF
+
/* Define to 1 if you have the <fp_class.h> header file. */
#undef HAVE_FP_CLASS_H
@@ -51,6 +54,18 @@
/* Define to 1 if you have the <nan.h> header file. */
#undef HAVE_NAN_H
+/* Define to 1 if you have the `printf' function. */
+#undef HAVE_PRINTF
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define to 1 if you have the `sprintf' function. */
+#undef HAVE_SPRINTF
+
+/* Define to 1 if you have the `sscanf' function. */
+#undef HAVE_SSCANF
+
/* Define to 1 if you have the `stat' function. */
#undef HAVE_STAT
@@ -90,6 +105,15 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if you have the `vfprintf' function. */
+#undef HAVE_VFPRINTF
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* Define to 1 if you have the `vsprintf' function. */
+#undef HAVE_VSPRINTF
+
/* Define to 1 if you have the `_stat' function. */
#undef HAVE__STAT
diff --git a/configure.in b/configure.in
index d7b21aa0..2c6f4801 100644
--- a/configure.in
+++ b/configure.in
@@ -121,6 +121,21 @@ AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
AC_CHECK_FUNCS(gettimeofday)
AC_CHECK_FUNCS(mktime localtime asctime time gmtime ftime)
+dnl Checking the standard string functions availability
+AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
+ NEED_TRIO=1)
+dnl
+dnl Check for trio string functions
+dnl
+
+if test "${NEED_TRIO}" = "1" ; then
+ echo Reusing trio library for string functions
+ WITH_TRIO=1
+else
+ WITH_TRIO=0
+fi
+AC_SUBST(WITH_TRIO)
+
dnl
dnl Perl is just needed for generating some data for XSLtmark
dnl
diff --git a/libxslt/xsltconfig.h.in b/libxslt/xsltconfig.h.in
index 6cff68a8..cbaa61a4 100644
--- a/libxslt/xsltconfig.h.in
+++ b/libxslt/xsltconfig.h.in
@@ -66,6 +66,18 @@ extern "C" {
#endif
/**
+ * XSLT_NEED_TRIO:
+ *
+ * should be activated in the existing libc library lacks some of the
+ * string formatting function, in that case reuse the Trio ones already
+ * compiled in the libxml2 library.
+ */
+
+#if @WITH_TRIO@
+#define XSLT_NEED_TRIO
+#endif
+
+/**
* WITH_XSLT_DEBUGGER:
*
* Activate the compilation of the debugger support. Speed penalty
diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c
index a1914ccb..829de483 100644
--- a/libxslt/xsltutils.c
+++ b/libxslt/xsltutils.c
@@ -254,6 +254,10 @@ xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) {
* *
************************************************************************/
+#ifdef XSLT_NEED_TRIO
+#define vsnprintf trio_vsnprintf
+#endif
+
#define XSLT_GET_VAR_STR(msg, str) { \
int size; \
int chars; \
diff --git a/xsltproc/xsltproc.c b/xsltproc/xsltproc.c
index 2db74f20..09b239ff 100644
--- a/xsltproc/xsltproc.c
+++ b/xsltproc/xsltproc.c
@@ -175,10 +175,10 @@ xsltprocExternalEntityLoader(const char *URL, const char *ID,
xmlChar *newURL;
int len;
- len = xmlStrlen(paths[i]) + xmlStrlen(BAD_CAST URL) + 5;
- newURL = xmlMalloc(len);
+ newURL = xmlStrdup((const xmlChar *) paths[i]);
+ newURL = xmlStrcat(newURL, (const xmlChar *) "/");
+ newURL = xmlStrcat(newURL, (const xmlChar *) URL);
if (newURL != NULL) {
- snprintf(newURL, len, "%s/%s", paths[i], URL);
ret = defaultEntityLoader((const char *)newURL, ID, ctxt);
xmlFree(newURL);
if (ret != NULL) {