diff options
author | William M. Brack <wbrack@src.gnome.org> | 2004-10-15 05:46:56 +0000 |
---|---|---|
committer | William M. Brack <wbrack@src.gnome.org> | 2004-10-15 05:46:56 +0000 |
commit | 0d28f2ec4ee791dd12e0a7097d6093fab7b7501b (patch) | |
tree | 0645bb89072241188a914baf35668eaa6f7df10c /libexslt | |
parent | af054965320354eb72ff050b6ad3905d4942fbec (diff) | |
download | libxslt-0d28f2ec4ee791dd12e0a7097d6093fab7b7501b.tar.gz libxslt-0d28f2ec4ee791dd12e0a7097d6093fab7b7501b.tar.bz2 libxslt-0d28f2ec4ee791dd12e0a7097d6093fab7b7501b.zip |
changed date.c to use gmtime_r if available (bug 129983) fixed a namespace
* 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)
Diffstat (limited to 'libexslt')
-rw-r--r-- | libexslt/date.c | 11 | ||||
-rw-r--r-- | libexslt/functions.c | 23 |
2 files changed, 32 insertions, 2 deletions
diff --git a/libexslt/date.c b/libexslt/date.c index 29cbdfe8..1f4cc254 100644 --- a/libexslt/date.c +++ b/libexslt/date.c @@ -119,7 +119,8 @@ struct _exsltDateVal { #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 @@ -748,6 +749,9 @@ exsltDateCurrent (void) #if HAVE_LOCALTIME_R struct tm localTmS; #endif +#if HAVE_GMTIME_R + struct tm gmTmS; +#endif exsltDateValPtr ret; ret = exsltDateCreateDate(XS_DATETIME); @@ -775,7 +779,12 @@ exsltDateCurrent (void) 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) + diff --git a/libexslt/functions.c b/libexslt/functions.c index d4ab48cf..bed952df 100644 --- a/libexslt/functions.c +++ b/libexslt/functions.c @@ -41,6 +41,8 @@ typedef struct _exsltFuncResultPreComp exsltFuncResultPreComp; struct _exsltFuncResultPreComp { xsltElemPreComp comp; xmlXPathCompExprPtr select; + xmlNsPtr *nsList; + int nsNr; }; /* Used for callback function in exsltInitFunc */ @@ -247,6 +249,8 @@ exsltFreeFuncResultPreComp (exsltFuncResultPreComp *comp) { if (comp->select != NULL) xmlXPathFreeCompExpr (comp->select); + if (comp->nsList != NULL) + xmlFree(comp->nsList); xmlFree(comp); } @@ -526,7 +530,16 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst, 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); } @@ -536,6 +549,8 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt, 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 @@ -569,7 +584,13 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt, 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"); |