r27118 - in /branches/upstream/libxml-libxslt-perl/current: Changes LibXSLT.pm LibXSLT.xs META.yml Makefile.PL perl-libxml-mm.c perl-libxml-mm.h t/01basic.t t/09exslt.t t/10functions.t t/11utf8.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sat Nov 22 15:54:05 UTC 2008


Author: gregoa
Date: Sat Nov 22 15:54:03 2008
New Revision: 27118

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=27118
Log:
[svn-upgrade] Integrating new upstream version, libxml-libxslt-perl (1.68)

Modified:
    branches/upstream/libxml-libxslt-perl/current/Changes
    branches/upstream/libxml-libxslt-perl/current/LibXSLT.pm
    branches/upstream/libxml-libxslt-perl/current/LibXSLT.xs
    branches/upstream/libxml-libxslt-perl/current/META.yml
    branches/upstream/libxml-libxslt-perl/current/Makefile.PL
    branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.c
    branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.h
    branches/upstream/libxml-libxslt-perl/current/t/01basic.t
    branches/upstream/libxml-libxslt-perl/current/t/09exslt.t
    branches/upstream/libxml-libxslt-perl/current/t/10functions.t
    branches/upstream/libxml-libxslt-perl/current/t/11utf8.t

Modified: branches/upstream/libxml-libxslt-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/Changes?rev=27118&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/Changes (original)
+++ branches/upstream/libxml-libxslt-perl/current/Changes Sat Nov 22 15:54:03 2008
@@ -1,6 +1,15 @@
 Revision history for Perl extension XML::LibXSLT.
 
-1.66pre
+1.68pre
+     - fix compilation problems
+     - skip exslt tests if not available
+     - added XML::LibXSLT::HAVE_EXSLT() (1/0)
+
+1.67
+     - sync the binary internals to those of XML::LibXML 1.67
+     - update regression tests for compatibility with up-to-date libxslt
+
+1.66
      - bump requirements to libxslt 1.1.8
      - sync the binary internals to those of XML::LibXML 1.66
 

Modified: branches/upstream/libxml-libxslt-perl/current/LibXSLT.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/LibXSLT.pm?rev=27118&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/LibXSLT.pm (original)
+++ branches/upstream/libxml-libxslt-perl/current/LibXSLT.pm Sat Nov 22 15:54:03 2008
@@ -1,10 +1,10 @@
-# $Id: LibXSLT.pm 205 2008-01-29 21:02:48Z pajas $
+# $Id: LibXSLT.pm 214 2008-11-05 13:24:52Z pajas $
 package XML::LibXSLT;
 
 use strict;
 use vars qw($VERSION @ISA $USE_LIBXML_DATA_TYPES $MatchCB $ReadCB $OpenCB $CloseCB);
 
-use XML::LibXML 1.66;
+use XML::LibXML 1.67;
 use XML::LibXML::Literal;
 use XML::LibXML::Boolean;
 use XML::LibXML::Number;
@@ -15,7 +15,7 @@
 
 require Exporter;
 
-$VERSION = "1.66";
+$VERSION = "1.68";
 
 require DynaLoader;
 
@@ -25,7 +25,7 @@
 
 # the following magic lets XML::LibXSLT internals know
 # where to register XML::LibXML proxy nodes
-__lib_init_proxy_registry(XML::LibXML::__proxy_registry());
+INIT_THREAD_SUPPORT() if XML::LibXML::threads_shared_enabled();
 $USE_LIBXML_DATA_TYPES = 0;
 }
 
@@ -949,6 +949,10 @@
 linked at runtime (either dynamically or statically). For example, for
 example, for libxslt.so.1.1.18, it will return 10118.
 
+=item XML::LibXSLT::HAVE_EXLT()
+
+Returns 1 if the module was compiled with libexslt, 0 otherwised.
+
 =back
 
 =head1 AUTHOR

Modified: branches/upstream/libxml-libxslt-perl/current/LibXSLT.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/LibXSLT.xs?rev=27118&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/LibXSLT.xs (original)
+++ branches/upstream/libxml-libxslt-perl/current/LibXSLT.xs Sat Nov 22 15:54:03 2008
@@ -1,4 +1,4 @@
-/* $Id: LibXSLT.xs 205 2008-01-29 21:02:48Z pajas $ */
+/* $Id: LibXSLT.xs 214 2008-11-05 13:24:52Z pajas $ */
 
 #ifdef __cplusplus
 extern "C" {
@@ -54,8 +54,7 @@
 
 static SV * LibXSLT_debug_cb = NULL;
 static HV * LibXSLT_HV_allCallbacks = NULL;
-ProxyNodePtr* PROXY_NODE_REGISTRY_PTR = NULL;
-
+SV* x_PROXY_NODE_REGISTRY_MUTEX = NULL;
 
 void
 LibXSLT_free_all_callbacks(void)
@@ -236,7 +235,6 @@
     char *strkey;
     const char *function, *uri;
     SV **perl_function;
-    AV *arguments;
     xmlDocPtr container;
     xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt);
     dSP;
@@ -323,7 +321,7 @@
     SPAGAIN;
 
     if (SvTRUE(ERRSV)) {
-        POPs;
+        (void) POPs;
         croak("LibXSLT: error coming back from perl-dispatcher in pm file. %s\n", SvPV(ERRSV, n_a));
     } 
 
@@ -362,7 +360,7 @@
 		} else {
 		  tmp_node = xmlDocCopyNode(tmp_node1, container, 1);
 		  /* a wraper element is needed to prevent libxml2 from merging adjacent text nodes */
-		  tmp_node2 = xmlNewDocNode(container,NULL,"x",NULL);
+		  tmp_node2 = xmlNewDocNode(container,NULL,(xmlChar*) "x",NULL);
 		  xmlAddChild((xmlNodePtr)container,tmp_node2);
 		  xmlAddChild(tmp_node2,tmp_node);
 		  xmlXPathNodeSetAdd(ret->nodesetval, tmp_node);
@@ -456,7 +454,7 @@
         }
 
         if (SvTRUE(ERRSV)) {
-            POPs ;
+            (void) POPs ;
             croak("input match callback died: %s", SvPV_nolen(ERRSV));
         }
 
@@ -500,7 +498,7 @@
     }
 
     if (SvTRUE(ERRSV)) {
-        POPs ;
+        (void) POPs ;
         croak("input callback died: %s", SvPV_nolen(ERRSV));
     }
 
@@ -550,7 +548,7 @@
         }
 
         if (SvTRUE(ERRSV)) {
-            POPs ;
+            (void) POPs ;
             croak("read callback died: %s", SvPV_nolen(ERRSV));
         }
 
@@ -640,7 +638,7 @@
       }
 
       if (SvTRUE(ERRSV)) {
-         POPs;
+          (void) POPs;
          croak("security callback died: %s", SvPV_nolen(ERRSV));
       }
 
@@ -741,6 +739,17 @@
     exsltRegisterAll();
 #endif
 
+int
+HAVE_EXSLT()
+    CODE:
+#ifdef HAVE_EXSLT
+        RETVAL = 1;
+#else
+        RETVAL = 0;
+#endif
+    OUTPUT:
+        RETVAL
+
 char *
 LIBXSLT_DOTTED_VERSION()
     CODE:
@@ -767,6 +776,7 @@
 xinclude_default(self, ...)
         SV * self
     CODE:
+        PERL_UNUSED_VAR(self);
         RETVAL = xsltGetXIncludeDefault();
         if (items > 1) {
            xsltSetXIncludeDefault(SvIV(ST(1)));
@@ -778,6 +788,7 @@
 max_depth(self, ...)
         SV * self
     CODE:
+        PERL_UNUSED_VAR(self);
         RETVAL = xsltMaxDepth;
         if (items > 1) {
             xsltMaxDepth = SvIV(ST(1));
@@ -796,7 +807,7 @@
         SV *key;
         STRLEN len;
         char *strkey;
-        
+        PERL_UNUSED_VAR(self);        
         /* todo: Add checking of uri and name in here! */
         xsltRegisterExtModuleFunction((const xmlChar *)name,
                         (const xmlChar *)uri,
@@ -816,6 +827,7 @@
 debug_callback(self, ...)
         SV * self
     CODE:
+        PERL_UNUSED_VAR(self);
         if (items > 1) {
             SV * debug_cb = ST(1);
             if (debug_cb && SvTRUE(debug_cb)) {
@@ -839,6 +851,7 @@
         xmlDocPtr doc;
         SV * saved_error = sv_2mortal(newSVpv("",0));
     CODE:
+        PERL_UNUSED_VAR(self);
         if (sv_doc == NULL) {
             XSRETURN_UNDEF;
         }
@@ -855,7 +868,7 @@
         if (LibXSLT_debug_cb && SvTRUE(LibXSLT_debug_cb)) {
             xsltSetGenericDebugFunc(PerlIO_stderr(), (xmlGenericErrorFunc)LibXSLT_debug_handler);
         }
-        else {
+	else {
             xsltSetGenericDebugFunc(NULL, NULL);
         }
 
@@ -878,7 +891,7 @@
         char * CLASS = "XML::LibXSLT::Stylesheet";
         SV * saved_error = sv_2mortal(newSVpv("",0));
     CODE:
-
+        PERL_UNUSED_VAR(self);
         if (LibXSLT_debug_cb && SvTRUE(LibXSLT_debug_cb)) {
             xsltSetGenericDebugFunc(PerlIO_stderr(), (xmlGenericErrorFunc)LibXSLT_debug_handler);
         }
@@ -900,6 +913,7 @@
 lib_init_callbacks( self )
         SV * self
     CODE:
+        PERL_UNUSED_VAR(self);
         xmlRegisterInputCallbacks((xmlInputMatchCallback) LibXSLT_input_match,
                                   (xmlInputOpenCallback) LibXSLT_input_open,
                                   (xmlInputReadCallback) LibXSLT_input_read,
@@ -909,22 +923,17 @@
 lib_cleanup_callbacks( self )
         SV * self
     CODE:
+        PERL_UNUSED_VAR(self);
         xmlCleanupInputCallbacks();
         xmlRegisterDefaultInputCallbacks();
 
 void
-__lib_init_proxy_registry( scalar )
-        SV* scalar;
-    CODE:
-	if (PROXY_NODE_REGISTRY_PTR != NULL) {
-	  croak("XML::LibXSLT::__lib_init_proxy_registry must be called only once!\n");
-	}
-	if (scalar!=NULL && scalar != &PL_sv_undef) {
-  	     PROXY_NODE_REGISTRY_PTR = (ProxyNodePtr*) SvIV((SV*)SvRV(scalar));
-	}
-	if (PROXY_NODE_REGISTRY_PTR == NULL) {
-	  croak("XML::LibXSLT::__lib_init_proxy_registry failed to initialize the proxy registry!\n");
-	}
+INIT_THREAD_SUPPORT()
+    CODE:
+       if (x_PROXY_NODE_REGISTRY_MUTEX != NULL) {
+	  croak("XML::LibXSLT::INIT_THREAD_SUPPORT can only be called once!\n");
+       }
+       x_PROXY_NODE_REGISTRY_MUTEX = get_sv("XML::LibXML::__PROXY_NODE_REGISTRY_MUTEX",0);
 
 MODULE = XML::LibXSLT         PACKAGE = XML::LibXSLT::Stylesheet
 
@@ -1142,7 +1151,7 @@
         xmlOutputBufferClose(output);
 
         if ((bytes_vs_chars == 2) ||
-            (bytes_vs_chars == 0) && xmlStrEqual(encoding, (const xmlChar *) "UTF-8")) {
+            ((bytes_vs_chars == 0) && xmlStrEqual(encoding, (const xmlChar *) "UTF-8"))) {
 	  SvUTF8_on( results );
 	}
         RETVAL = results;
@@ -1216,16 +1225,16 @@
             RETVAL = "text/xml";
             /* this below is rather simplistic, but should work for most cases */
             if (method != NULL) {
-        	if (strcmp(method, "html") == 0) {
+        	if (xmlStrcmp(method, (xmlChar*) "html") == 0) {
                     RETVAL = "text/html";
         	}
-        	else if (strcmp(method, "text") == 0) {
+        	else if (xmlStrcmp(method, (xmlChar*) "text") == 0) {
                     RETVAL = "text/plain";
         	}
             }
         }
 	else {
-	    RETVAL = mediaType;
+	    RETVAL = (char*) mediaType;
 	}
     OUTPUT:
         RETVAL
@@ -1238,7 +1247,7 @@
     CODE:
     	XSLT_GET_IMPORT_PTR(encoding, self, encoding)
 	
-        RETVAL = encoding;
+        RETVAL = (char*) encoding;
         if (RETVAL == NULL) {
             RETVAL = "UTF-8";
         }

Modified: branches/upstream/libxml-libxslt-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/META.yml?rev=27118&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/META.yml (original)
+++ branches/upstream/libxml-libxslt-perl/current/META.yml Sat Nov 22 15:54:03 2008
@@ -1,14 +1,11 @@
---- #YAML:1.0
-name:                XML-LibXSLT
-version:             1.66
-abstract:            Interface to Gnome libxslt library
-license:             ~
-author:              
-    - Matt Sergeant
-generated_by:        ExtUtils::MakeMaker version 6.42
-distribution_type:   module
-requires:     
-    XML::LibXML:                   1.66
-meta-spec:
-    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
-    version: 1.3
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         XML-LibXSLT
+version:      1.68
+version_from: LibXSLT.pm
+installdirs:  site
+requires:
+    XML::LibXML:                   1.67
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30

Modified: branches/upstream/libxml-libxslt-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/Makefile.PL?rev=27118&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/Makefile.PL (original)
+++ branches/upstream/libxml-libxslt-perl/current/Makefile.PL Sat Nov 22 15:54:03 2008
@@ -1,7 +1,15 @@
-# $Id: Makefile.PL 205 2008-01-29 21:02:48Z pajas $
+# $Id: Makefile.PL 211 2008-11-05 10:30:33Z pajas $
+
+BEGIN {
+  if ($] < 5.006_001) {
+    warn "\nSorry, at least Perl 5.6.1 is required for this module!\n\n";
+    exit;
+  }
+}
 
 use ExtUtils::MakeMaker;
 use Config;
+
 
 $|=0;
 
@@ -13,6 +21,12 @@
 }
 
 my $DEBUG = delete $config{DEBUG};
+
+if ( $] < 5.008 or $config{NO_THREADS} ) {
+  warn "disabling XML::LibXML support for Perl threads\n";
+  $config{DEFINE} .= " -DNO_XML_LIBXML_THREADS";
+}
+delete $config{NO_THREADS};
 
 unless ( $is_Win32 ) { # cannot get config in W32
     my $xsltcfg = "xslt-config";
@@ -115,7 +129,7 @@
     'VERSION_FROM' => 'LibXSLT.pm', # finds $VERSION
     'AUTHOR'    => 'Matt Sergeant',
     'ABSTRACT'  => 'Interface to Gnome libxslt library',
-    'PREREQ_PM' => { 'XML::LibXML' => "1.66", },
+    'PREREQ_PM' => { 'XML::LibXML' => "1.67", },
     'OBJECT'     => '$(O_FILES)',
     %config,
 );

Modified: branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.c?rev=27118&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.c (original)
+++ branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.c Sat Nov 22 15:54:03 2008
@@ -1,6 +1,6 @@
 /**
  * perl-libxml-mm.c
- * $Id: perl-libxml-mm.c 206 2008-01-29 21:08:07Z pajas $
+ * $Id: perl-libxml-mm.c 211 2008-11-05 10:30:33Z pajas $
  *
  * Basic concept:
  * perl varies in the implementation of UTF8 handling. this header (together
@@ -84,66 +84,107 @@
     return "";
 }
 
-
-/*
- * This is XML::LibXSLT specific:
- *
- * a pointer to XML::LibXML's registry of all current proxy nodes
- */
-extern ProxyNodePtr* PROXY_NODE_REGISTRY_PTR;
-#define PROXY_NODE_REGISTRY *PROXY_NODE_REGISTRY_PTR
+/*
+ * registry of all current proxy nodes
+ *
+ * other classes like XML::LibXSLT must get a pointer
+ * to this registry via XML::LibXML::__proxy_registry
+ *
+ */
+extern SV* x_PROXY_NODE_REGISTRY_MUTEX;
+
+#ifdef XML_LIBXML_THREADS
+
+/*
+ * returns the address of the proxy registry
+ */
+xmlHashTablePtr*
+x_PmmProxyNodeRegistryPtr(ProxyNodePtr proxy)
+{
+	croak("x_PmmProxyNodeRegistryPtr: TODO!\n");
+	return NULL;
+	/*   return &x_PmmREGISTRY; */
+}
+
+/*
+ * efficiently generate a string representation of the given pointer
+ */
+xmlChar *
+x_PmmRegistryName(void * ptr)
+{
+	unsigned long int v = (unsigned long int) ptr;
+	int HASH_NAME_SIZE = sizeof(void *) + ceil(sizeof(void *)/8);
+	xmlChar * name;
+	int i;
+
+	name = (xmlChar *) safemalloc(HASH_NAME_SIZE+1);
+
+	for(i = 0; i < HASH_NAME_SIZE; ++i)
+	{
+		name[i] = (xmlChar) (128 | v);
+		v >>= 7;
+	}
+	name[HASH_NAME_SIZE] = '\0';
+
+	return name;
+}
+
+/*
+ * allocate and return a new LocalProxyNode structure
+ */
+LocalProxyNodePtr
+x_PmmNewLocalProxyNode(ProxyNodePtr proxy)
+{
+	LocalProxyNodePtr lp;
+	Newc(0, lp, 1, LocalProxyNode, LocalProxyNode);
+	lp->proxy = proxy;
+	lp->count = 0;
+	return lp;
+}
 
 /*
  * @proxy: proxy node to register
  *
  * adds a proxy node to the proxy node registry
  */
+LocalProxyNodePtr
+x_PmmRegisterProxyNode(ProxyNodePtr proxy)
+{
+	xmlChar * name = x_PmmRegistryName( proxy );
+	LocalProxyNodePtr lp = x_PmmNewLocalProxyNode( proxy );
+        /* warn("LibXML registers proxy node with %p\n",x_PmmREGISTRY); */
+	SvLOCK(x_PROXY_NODE_REGISTRY_MUTEX);
+	if( xmlHashAddEntry(x_PmmREGISTRY, name, lp) )
+		croak("x_PmmRegisterProxyNode: error adding node to hash, hash size is %d\n",xmlHashSize(x_PmmREGISTRY));
+	SvUNLOCK(x_PROXY_NODE_REGISTRY_MUTEX);
+	Safefree(name);
+	return lp;
+}
+
+/*
+ * lookup a LocalProxyNode in the registry
+ */
+LocalProxyNodePtr
+x_PmmRegistryLookup(ProxyNodePtr proxy)
+{
+	xmlChar * name = x_PmmRegistryName( proxy );
+	LocalProxyNodePtr lp = xmlHashLookup(x_PmmREGISTRY, name);
+	Safefree(name);
+	return lp;
+}
+
+/*
+ * increment the local refcount for proxy
+ */
 void
-x_PmmRegisterProxyNode(ProxyNodePtr proxy)
-{
-  proxy->_registry = PROXY_NODE_REGISTRY;
-  PROXY_NODE_REGISTRY = proxy;
-}
-
-/*
- * @proxy: proxy node to remove
- *
- * removes a proxy node from the proxy node registry
- */
-void
-x_PmmUnregisterProxyNode(ProxyNodePtr proxy)
-{
-    ProxyNodePtr cur = PROXY_NODE_REGISTRY;
-    if( PROXY_NODE_REGISTRY == proxy ) {
-        PROXY_NODE_REGISTRY = proxy->_registry;
-    }
-    else if (cur!=NULL) {
-        while(cur->_registry != NULL)
-        {
-            if( cur->_registry == proxy )
-            {
-                cur->_registry = proxy->_registry;
-                break;
-            }
-            cur = cur->_registry;
-        }
-    } else {
-      warn("XML::LibXSLT: Unregistering a node while no node was registered?");
-    }
-}
-
-/*
- * increments all proxy node counters by one (called on thread spawn)
- */
-void
-x_PmmCloneProxyNodes()
-{
-    ProxyNodePtr cur = PROXY_NODE_REGISTRY;
-    while(cur != NULL)
-    {
-        x_PmmREFCNT_inc(cur);
-        cur = cur->_registry;
-    }
+x_PmmRegistryREFCNT_inc(ProxyNodePtr proxy)
+{
+  /* warn("Registry inc\n"); */
+	LocalProxyNodePtr lp = x_PmmRegistryLookup( proxy );
+	if( lp )
+		lp->count++;
+	else
+		x_PmmRegisterProxyNode( proxy )->count++;
 }
 
 /*
@@ -152,15 +193,10 @@
 int
 x_PmmProxyNodeRegistrySize()
 {
-    int i = 0;
-    ProxyNodePtr cur = PROXY_NODE_REGISTRY;
-    while(cur != NULL)
-    {
-        ++i;
-        cur = cur->_registry;
-    }
-    return i;
-}
+	return xmlHashSize(x_PmmREGISTRY);
+}
+
+#endif /* XML_LIBXML_THREADS */
 
 /* creates a new proxy node from a given node. this function is aware
  * about the fact that a node may already has a proxy structure.
@@ -176,23 +212,17 @@
     }
 
     if ( node->_private == NULL ) {
-        /* proxy = (ProxyNodePtr)malloc(sizeof(struct _ProxyNode));  */
-        Newc(0, proxy, 1, ProxyNode, ProxyNode);
+        proxy = (ProxyNodePtr)xmlMalloc(sizeof(struct _ProxyNode));
         if (proxy != NULL) {
             proxy->node  = node;
             proxy->owner   = NULL;
             proxy->count   = 0;
             proxy->encoding= 0;
-            proxy->_registry = NULL;
             node->_private = (void*) proxy;
-            x_PmmRegisterProxyNode(proxy);
         }
     }
     else {
         proxy = (ProxyNodePtr)node->_private;
-	if (proxy->_registry==NULL && PROXY_NODE_REGISTRY!=proxy) {
-	  x_PmmRegisterProxyNode(proxy);
-	}
     }
 
     return proxy;
@@ -223,110 +253,6 @@
     return retval;
 }
 
-/* frees the node if nessecary. this method is aware, that libxml2
- * has several diffrent nodetypes.
- */
-void
-x_PmmFreeNode( xmlNodePtr node )
-{  
-    switch( node->type ) {
-    case XML_DOCUMENT_NODE:
-    case XML_HTML_DOCUMENT_NODE:
-        xs_warn("x_PmmFreeNode: XML_DOCUMENT_NODE\n");
-        xmlFreeDoc( (xmlDocPtr) node );
-        break;
-    case XML_ATTRIBUTE_NODE:
-        xs_warn("x_PmmFreeNode: XML_ATTRIBUTE_NODE\n");
-        if ( node->parent == NULL ) {
-            xs_warn( "x_PmmFreeNode:   free node!\n");
-            node->ns = NULL;
-            xmlFreeProp( (xmlAttrPtr) node );
-        }
-        break;
-    case XML_DTD_NODE:
-        if ( node->doc != NULL ) {
-            if ( node->doc->extSubset != (xmlDtdPtr)node 
-                 && node->doc->intSubset != (xmlDtdPtr)node ) {
-                xs_warn( "x_PmmFreeNode: XML_DTD_NODE\n");
-                node->doc = NULL;
-                xmlFreeDtd( (xmlDtdPtr)node );
-            }
-        } else {
-            xs_warn( "x_PmmFreeNode: XML_DTD_NODE (no doc)\n");
-            xmlFreeDtd( (xmlDtdPtr)node );
-        }
-        break;
-    case XML_DOCUMENT_FRAG_NODE:
-        xs_warn("x_PmmFreeNode: XML_DOCUMENT_FRAG_NODE\n");
-    default:
-        xs_warn( "x_PmmFreeNode: normal node\n" );
-        xmlFreeNode( node);
-        break;
-    }
-}
-
-/* decrements the proxy counter. if the counter becomes zero or less,
-   this method will free the proxy node. If the node is part of a
-   subtree, x_PmmREFCNT_dec will fix the reference counts and delete
-   the subtree if it is not required any more.
- */
-int
-x_PmmREFCNT_dec( ProxyNodePtr node ) 
-{ 
-    xmlNodePtr libnode = NULL;
-    ProxyNodePtr owner = NULL;  
-    int retval = 0;
-
-    if ( node != NULL ) {
-        retval = x_PmmREFCNT(node)--;
-	/* fprintf(stderr, "REFCNT on 0x%08.8X decremented to %d\n", node, x_PmmREFCNT(node)); */
-        if ( x_PmmREFCNT(node) < 0 )
-            warn( "x_PmmREFCNT_dec: REFCNT decremented below 0!" );
-        if ( x_PmmREFCNT(node) <= 0 ) {
-            xs_warn( "x_PmmREFCNT_dec: NODE DELETION\n" );
-
-            libnode = x_PmmNODE( node );
-            if ( libnode != NULL ) {
-                if ( libnode->_private != node ) {
-                    xs_warn( "x_PmmREFCNT_dec:   lost node\n" );
-                    libnode = NULL;
-                }
-                else {
-                    libnode->_private = NULL;
-                }
-            }
-
-            x_PmmNODE( node ) = NULL;
-            if ( x_PmmOWNER(node) && x_PmmOWNERPO(node) ) {
-                xs_warn( "x_PmmREFCNT_dec:   DOC NODE!\n" );
-                owner = x_PmmOWNERPO(node);
-                x_PmmOWNER( node ) = NULL;
-                if( libnode != NULL && libnode->parent == NULL ) {
-                    /* this is required if the node does not directly
-                     * belong to the document tree
-                     */
-                    xs_warn( "x_PmmREFCNT_dec:     REAL DELETE\n" );
-                    x_PmmFreeNode( libnode );
-                }
-                xs_warn( "x_PmmREFCNT_dec:   decrease owner\n" );
-                x_PmmREFCNT_dec( owner );
-            }
-            else if ( libnode != NULL ) {
-                xs_warn( "x_PmmREFCNT_dec:   STANDALONE REAL DELETE\n" );
-                
-                x_PmmFreeNode( libnode );
-            }
-            x_PmmUnregisterProxyNode(node);
-            Safefree( node );
-            /* free( node ); */
-        }
-    }
-    else {
-        xs_warn("x_PmmREFCNT_dec: lost node\n" );
-    }
-    return retval;
-}
-
 /* @node: the node that should be wrapped into a SV
  * @owner: perl instance of the owner node (may be NULL)
  *
@@ -348,6 +274,10 @@
     const char * CLASS = "XML::LibXML::Node";
 
     if ( node != NULL ) {
+#ifdef XML_LIBXML_THREADS
+      if( x_PmmUSEREGISTRY )
+		SvLOCK(x_PROXY_NODE_REGISTRY_MUTEX);
+#endif
         /* find out about the class */
         CLASS = x_PmmNodeTypeName( node );
         xs_warn("x_PmmNodeToSv: return new perl node of class:\n");
@@ -377,6 +307,10 @@
 
         retval = NEWSV(0,0);
         sv_setref_pv( retval, CLASS, (void*)dfProxy );
+#ifdef XML_LIBXML_THREADS
+	if( x_PmmUSEREGISTRY )
+	    x_PmmRegistryREFCNT_inc(dfProxy);
+#endif
         x_PmmREFCNT_inc(dfProxy); 
         /* fprintf(stderr, "REFCNT incremented on node: 0x%08.8X\n", dfProxy); */
 
@@ -391,6 +325,10 @@
         default:
             break;
         }
+#ifdef XML_LIBXML_THREADS
+      if( x_PmmUSEREGISTRY )
+		SvUNLOCK(x_PROXY_NODE_REGISTRY_MUTEX);
+#endif
     }
     else {
         xs_warn( "x_PmmNodeToSv: no node found!\n" );

Modified: branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.h?rev=27118&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.h (original)
+++ branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.h Sat Nov 22 15:54:03 2008
@@ -1,6 +1,6 @@
 /**
  * perl-libxml-mm.h
- * $Id: perl-libxml-mm.h 200 2008-01-28 11:32:58Z pajas $
+ * $Id: perl-libxml-mm.h 208 2008-11-04 13:29:43Z pajas $
  *
  * Basic concept:
  * perl varies in the implementation of UTF8 handling. this header (together
@@ -50,7 +50,6 @@
     xmlNodePtr owner;
     int count;
     int encoding;
-    struct _ProxyNode * _registry;
 };
 
 /* helper type for the proxy structure */
@@ -74,6 +73,27 @@
 #define x_PmmNodeEncoding(node) ((ProxyNodePtr)(node->_private))->encoding
 #define x_PmmDocEncoding(node) (node->charset)
 
+#ifndef NO_XML_LIBXML_THREADS
+#ifdef USE_ITHREADS
+#define XML_LIBXML_THREADS
+#endif
+#endif
+
+#ifdef XML_LIBXML_THREADS
+
+/* structure for storing thread-local refcount */
+struct _LocalProxyNode {
+	ProxyNodePtr proxy;
+	int count;
+};
+typedef struct _LocalProxyNode LocalProxyNode;
+typedef LocalProxyNode* LocalProxyNodePtr;
+
+
+#define x_PmmUSEREGISTRY		(x_PROXY_NODE_REGISTRY_MUTEX != NULL)
+#define x_PmmREGISTRY		(INT2PTR(xmlHashTablePtr,SvIV(SvRV(get_sv("XML::LibXML::__PROXY_NODE_REGISTRY",0)))))
+
+#endif /* XML_LIBXML_THREADS */
 
 ProxyNodePtr
 x_PmmNewNode(xmlNodePtr node);

Modified: branches/upstream/libxml-libxslt-perl/current/t/01basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/t/01basic.t?rev=27118&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/t/01basic.t (original)
+++ branches/upstream/libxml-libxslt-perl/current/t/01basic.t Sat Nov 22 15:54:03 2008
@@ -1,5 +1,5 @@
 use Test;
-BEGIN { plan tests => 2 }
+BEGIN { plan tests => 4 }
 END { ok(0) unless $loaded }
 use XML::LibXSLT;
 $loaded = 1;
@@ -7,3 +7,22 @@
 
 my $p = XML::LibXSLT->new();
 ok($p);
+
+ok(XML::LibXSLT::LIBXSLT_VERSION, XML::LibXSLT::LIBXSLT_RUNTIME_VERSION);
+ok(XML::LibXML::LIBXML_VERSION, XML::LibXML::LIBXML_RUNTIME_VERSION);
+
+warn "\n\nCompiled against:    ",
+       "libxslt ",XML::LibXSLT::LIBXSLT_VERSION,
+       ", libxml2 ",XML::LibXML::LIBXML_VERSION,
+       "\nRunning:             ",
+       "libxslt ",XML::LibXSLT::LIBXSLT_RUNTIME_VERSION,
+       ", libxml2 ",XML::LibXML::LIBXML_RUNTIME_VERSION,
+       "\nCompiled with EXSLT: ", (XML::LibXSLT::HAVE_EXSLT() ? 'yes' : 'no'),
+     "\n\n";
+
+if (XML::LibXSLT::LIBXSLT_VERSION != XML::LibXSLT::LIBXSLT_RUNTIME_VERSION
+    or    
+    XML::LibXML::LIBXML_VERSION != XML::LibXML::LIBXML_RUNTIME_VERSION	
+    ) {
+   warn "DO NOT REPORT THIS FAILURE: Your setup of library paths is incorrect!\n\n";
+}

Modified: branches/upstream/libxml-libxslt-perl/current/t/09exslt.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/t/09exslt.t?rev=27118&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/t/09exslt.t (original)
+++ branches/upstream/libxml-libxslt-perl/current/t/09exslt.t Sat Nov 22 15:54:03 2008
@@ -1,7 +1,14 @@
 use Test;
-BEGIN { plan tests => 6 }
+use constant PLAN => 6;
+BEGIN { plan tests => PLAN; }
+
 use XML::LibXSLT;
 use XML::LibXML;
+
+unless (XML::LibXSLT::HAVE_EXSLT()) {
+  skip("this test requires XML::LibXSLT to be compiled with libexslt\n") for (1..PLAN);	
+  exit;
+}
 
 my $parser = XML::LibXML->new();
 ok($parser);

Modified: branches/upstream/libxml-libxslt-perl/current/t/10functions.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/t/10functions.t?rev=27118&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/t/10functions.t (original)
+++ branches/upstream/libxml-libxslt-perl/current/t/10functions.t Sat Nov 22 15:54:03 2008
@@ -125,14 +125,17 @@
      );
     my $stylesheet = $xsltproc->parse_stylesheet($xslt);
     my $result = $stylesheet->transform($xml);
-    ok ($result->serialize,qq(<?xml version="1.0"?>\n<html xmlns:foo="http://foo"><head><foo>1st</foo><foo>2nd</foo></head></html>\n));
+    # the behavior has changed in some version of libxslt
+    my $expect = qq(<html xmlns:foo="http://foo"><head><foo>1st</foo><foo>2nd</foo></head></html>\n);
+    ok ($result->serialize,qr{(\Q<?xml version="1.0"?>\n\E)?\Q$expect\E});
   }
   {
     XML::LibXSLT->register_function(
       ('http://foo', 'custom') => sub { $parser->parse_string( $aux )->findnodes('//y')->[0]; });
     my $stylesheet = $xsltproc->parse_stylesheet($xslt);
     my $result = $stylesheet->transform($xml);
-    ok ($result->serialize,qq(<?xml version="1.0"?>\n<html xmlns:foo="http://foo"><head><foo>1st</foo></head></html>\n));
+    my $expect = qq(<html xmlns:foo="http://foo"><head><foo>1st</foo></head></html>\n);
+    ok ($result->serialize,qr{(\Q<?xml version="1.0"?>\n\E)?\Q$expect\E});
   }
 }
 

Modified: branches/upstream/libxml-libxslt-perl/current/t/11utf8.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/t/11utf8.t?rev=27118&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/t/11utf8.t (original)
+++ branches/upstream/libxml-libxslt-perl/current/t/11utf8.t Sat Nov 22 15:54:03 2008
@@ -1,10 +1,16 @@
 use strict;                     # -*- perl -*-
 use Test;
-BEGIN { plan tests => 32; }
+use constant PLAN => 32;
+BEGIN {
+  plan tests => PLAN;
+  unless (eval { require Encode; import Encode; 1 }) {
+    skip("this test requires Encode.pm\n") for (1..PLAN);
+    exit;
+  }
+}
 
 use XML::LibXSLT;
 use XML::LibXML;
-use Encode;
 
 my $parser = XML::LibXML->new();
 ok( $parser );




More information about the Pkg-perl-cvs-commits mailing list