| Index: third_party/libxslt/libxslt/extra.c
|
| diff --git a/third_party/libxslt/libxslt/extra.c b/third_party/libxslt/libxslt/extra.c
|
| index 17df4baef7739082fe8c113a2369ab486fc2fb40..2c99e4c443e688125c5ac689f9175b8c8d6c6270 100644
|
| --- a/third_party/libxslt/libxslt/extra.c
|
| +++ b/third_party/libxslt/libxslt/extra.c
|
| @@ -14,9 +14,6 @@
|
| #include "libxslt.h"
|
|
|
| #include <string.h>
|
| -#ifdef HAVE_TIME_H
|
| -#include <time.h>
|
| -#endif
|
| #ifdef HAVE_STDLIB_H
|
| #include <stdlib.h>
|
| #endif
|
| @@ -148,134 +145,6 @@ xsltFunctionNodeSet(xmlXPathParserContextPtr ctxt, int nargs){
|
| }
|
| }
|
|
|
| -
|
| -/*
|
| - * Okay the following really seems unportable and since it's not
|
| - * part of any standard I'm not too ashamed to do this
|
| - */
|
| -#if defined(linux) || defined(__sun)
|
| -#if defined(HAVE_MKTIME) && defined(HAVE_LOCALTIME) && defined(HAVE_ASCTIME)
|
| -#define WITH_LOCALTIME
|
| -
|
| -/**
|
| - * xsltFunctionLocalTime:
|
| - * @ctxt: the XPath Parser context
|
| - * @nargs: the number of arguments
|
| - *
|
| - * Implement the localTime XSLT function used by NORM
|
| - * string localTime(???)
|
| - *
|
| - * This function is available in Norm's extension namespace
|
| - * Code (and comments) contributed by Norm
|
| - */
|
| -static void
|
| -xsltFunctionLocalTime(xmlXPathParserContextPtr ctxt, int nargs) {
|
| - xmlXPathObjectPtr obj;
|
| - char *str;
|
| - char digits[5];
|
| - char result[29];
|
| - long int field;
|
| - time_t gmt, lmt;
|
| - struct tm gmt_tm;
|
| - struct tm *local_tm;
|
| -
|
| - if (nargs != 1) {
|
| - xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
|
| - "localTime() : invalid number of args %d\n", nargs);
|
| - ctxt->error = XPATH_INVALID_ARITY;
|
| - return;
|
| - }
|
| -
|
| - obj = valuePop(ctxt);
|
| -
|
| - if (obj->type != XPATH_STRING) {
|
| - obj = xmlXPathConvertString(obj);
|
| - }
|
| - if (obj == NULL) {
|
| - valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
|
| - return;
|
| - }
|
| -
|
| - str = (char *) obj->stringval;
|
| -
|
| - /* str = "$Date$" */
|
| - memset(digits, 0, sizeof(digits));
|
| - strncpy(digits, str+7, 4);
|
| - field = strtol(digits, NULL, 10);
|
| - gmt_tm.tm_year = field - 1900;
|
| -
|
| - memset(digits, 0, sizeof(digits));
|
| - strncpy(digits, str+12, 2);
|
| - field = strtol(digits, NULL, 10);
|
| - gmt_tm.tm_mon = field - 1;
|
| -
|
| - memset(digits, 0, sizeof(digits));
|
| - strncpy(digits, str+15, 2);
|
| - field = strtol(digits, NULL, 10);
|
| - gmt_tm.tm_mday = field;
|
| -
|
| - memset(digits, 0, sizeof(digits));
|
| - strncpy(digits, str+18, 2);
|
| - field = strtol(digits, NULL, 10);
|
| - gmt_tm.tm_hour = field;
|
| -
|
| - memset(digits, 0, sizeof(digits));
|
| - strncpy(digits, str+21, 2);
|
| - field = strtol(digits, NULL, 10);
|
| - gmt_tm.tm_min = field;
|
| -
|
| - memset(digits, 0, sizeof(digits));
|
| - strncpy(digits, str+24, 2);
|
| - field = strtol(digits, NULL, 10);
|
| - gmt_tm.tm_sec = field;
|
| -
|
| - /* Now turn gmt_tm into a time. */
|
| - gmt = mktime(&gmt_tm);
|
| -
|
| -
|
| - /*
|
| - * FIXME: it's been too long since I did manual memory management.
|
| - * (I swore never to do it again.) Does this introduce a memory leak?
|
| - */
|
| - local_tm = localtime(&gmt);
|
| -
|
| - /*
|
| - * Calling localtime() has the side-effect of setting timezone.
|
| - * After we know the timezone, we can adjust for it
|
| - */
|
| -#if !defined(__FreeBSD__)
|
| - lmt = gmt - timezone;
|
| -#else /* FreeBSD DOESN'T have such side-ffect */
|
| - lmt = gmt - local_tm->tm_gmtoff;
|
| -#endif
|
| - /*
|
| - * FIXME: it's been too long since I did manual memory management.
|
| - * (I swore never to do it again.) Does this introduce a memory leak?
|
| - */
|
| - local_tm = localtime(&lmt);
|
| -
|
| - /*
|
| - * Now convert local_tm back into a string. This doesn't introduce
|
| - * a memory leak, so says asctime(3).
|
| - */
|
| -
|
| - str = asctime(local_tm); /* "Tue Jun 26 05:02:16 2001" */
|
| - /* 0123456789 123456789 123 */
|
| -
|
| - memset(result, 0, sizeof(result)); /* "Thu, 26 Jun 2001" */
|
| - /* 0123456789 12345 */
|
| -
|
| - strncpy(result, str, 20);
|
| - strcpy(result+20, "???"); /* tzname doesn't work, fake it */
|
| - strncpy(result+23, str+19, 5);
|
| -
|
| - /* Ok, now result contains the string I want to send back. */
|
| - valuePush(ctxt, xmlXPathNewString((xmlChar *)result));
|
| -}
|
| -#endif
|
| -#endif /* linux or sun */
|
| -
|
| -
|
| /**
|
| * xsltRegisterExtras:
|
| * @ctxt: a XSLT process context
|
| @@ -304,11 +173,6 @@ xsltRegisterAllExtras (void) {
|
| xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
|
| XSLT_XT_NAMESPACE,
|
| xsltFunctionNodeSet);
|
| -#ifdef WITH_LOCALTIME
|
| - xsltRegisterExtModuleFunction((const xmlChar *) "localTime",
|
| - XSLT_NORM_SAXON_NAMESPACE,
|
| - xsltFunctionLocalTime);
|
| -#endif
|
| xsltRegisterExtModuleElement((const xmlChar *) "debug",
|
| XSLT_LIBXSLT_NAMESPACE,
|
| NULL,
|
|
|