+Thu Oct 14 22:43:22 PDT 2004 William Brack <wbrack@mmm.com.hk>
+
+ * configure.in, config.h.in, libexslt/date.c: changed date.c to use
+ gmtime_r if available (bug 129983)
+ * libexslt/functions.c: fixed a namespace problem concerning a
+ function with a namespace-qualified name (bug 155197)
+
Tue Oct 12 03:54:44 CEST 2004 Daniel Veillard <daniel@veillard.com>
* libxslt/namespaces.c: fixed a bug in namespace lookup exhibited
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
-/* Define to 1 if you have the `gmtime' function. */
-#undef HAVE_GMTIME
+/* Define to 1 if you have the `gmtime_r' function. */
+#undef HAVE_GMTIME_R
/* Define to 1 if you have the <ieeefp.h> header file. */
#undef HAVE_IEEEFP_H
AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
[M_LIBS="-lm"; AC_DEFINE(HAVE_FABS)]))
AC_CHECK_FUNCS(gettimeofday)
-AC_CHECK_FUNCS(mktime localtime localtime_r asctime time gmtime ftime)
+AC_CHECK_FUNCS(mktime localtime localtime_r asctime time gmtime_r 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 defined(HAVE_TIME_H) \
&& (defined(HAVE_LOCALTIME) || defined(HAVE_LOCALTIME_R)) \
- && defined(HAVE_TIME) && defined(HAVE_GMTIME)
+ && (defined(HAVE_GMTIME) || defined(HAVE_GMTIME_R)) \
+ && defined(HAVE_TIME)
#define WITH_TIME
#endif
#if HAVE_LOCALTIME_R
struct tm localTmS;
#endif
+#if HAVE_GMTIME_R
+ struct tm gmTmS;
+#endif
exsltDateValPtr ret;
ret = exsltDateCreateDate(XS_DATETIME);
ret->value.date.sec = (double) localTm->tm_sec;
/* determine the time zone offset from local to gm time */
+#if HAVE_GMTIME_R
+ gmtime_r(&secs, &gmTmS);
+ gmTm = &gmTmS;
+#else
gmTm = gmtime(&secs);
+#endif
ret->value.date.tz_flag = 0;
ret->value.date.tzo = (((ret->value.date.day * 1440) +
(ret->value.date.hour * 60) +
struct _exsltFuncResultPreComp {
xsltElemPreComp comp;
xmlXPathCompExprPtr select;
+ xmlNsPtr *nsList;
+ int nsNr;
};
/* Used for callback function in exsltInitFunc */
if (comp->select != NULL)
xmlXPathFreeCompExpr (comp->select);
+ if (comp->nsList != NULL)
+ xmlFree(comp->nsList);
xmlFree(comp);
}
ret->select = xmlXPathCompile (select);
xmlFree(select);
}
-
+ /*
+ * Precompute the namespace list
+ */
+ ret->nsList = xmlGetNsList(inst->doc, inst);
+ if (ret->nsList != NULL) {
+ int i = 0;
+ while (ret->nsList[i] != NULL)
+ i++;
+ ret->nsNr = i;
+ }
return ((xsltElemPreCompPtr) ret);
}
exsltFuncResultPreComp *comp) {
exsltFuncData *data;
xmlXPathObjectPtr ret;
+ xmlNsPtr *oldNsList;
+ int oldNsNr;
/* It is an error if instantiating the content of the
* func:function element results in the instantiation of more than
data->error = 1;
return;
}
+ oldNsList = ctxt->xpathCtxt->namespaces;
+ oldNsNr = ctxt->xpathCtxt->nsNr;
+ ctxt->xpathCtxt->namespaces = comp->nsList;
+ ctxt->xpathCtxt->nsNr = comp->nsNr;
ret = xmlXPathCompiledEval(comp->select, ctxt->xpathCtxt);
+ ctxt->xpathCtxt->nsNr = oldNsNr;
+ ctxt->xpathCtxt->namespaces = oldNsList;
if (ret == NULL) {
xsltGenericError(xsltGenericErrorContext,
"exsltFuncResultElem: ret == NULL\n");