Commits

Anonymous committed 507b87b

Modified Files:
dom.c perl-libxml-mm.c
+ variable initialization

perl-libxml-sax.c
+ makes all perl-scalars mortals now

README
added download information for windows PPMs

  • Participants
  • Parent commits 317ff50

Comments (0)

Files changed (4)

 > 
 > perl Makefile.PL LIBS='-L/path/to/lib' INC='-I/path/to/include'
 
+NOTES FOR M$ Windows
+====================
+
+Thanks to Randy Kobes there is a precompiled PPM package available on
+
+http://theoryx5.uwinnipeg.ca/ppmpackages/
+
+Usually it takes a little time to build the package for the latest
+release. 
 
 Contact
 =======
 int
 domAddNodeToList(xmlNodePtr cur, xmlNodePtr leader, xmlNodePtr followup) 
 {
-   xmlNodePtr c1, c2, p = NULL;
+   xmlNodePtr c1 = NULL, c2 = NULL, p = NULL;
    if ( cur ) { 
        c1 = c2 = cur;
        if( leader )
         domAddNodeToList( newChild, self->last, NULL );
     }
     else if (newChild->type == XML_DOCUMENT_FRAG_NODE ) {
-        xmlNodePtr c1;
+        xmlNodePtr c1 = NULL;
         newChild->children->parent = self;
         self->children = newChild->children;
         c1 = newChild->children;
 
 xmlNodePtr
 domReplaceNode( xmlNodePtr oldNode, xmlNodePtr newNode ) {
-    xmlNodePtr prev, next, par;
+    xmlNodePtr prev = NULL, next = NULL, par = NULL;
     
     if ( oldNode == NULL
          || newNode == NULL ) {
  */
 xmlAttrPtr
 domHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *namespace) {
-    xmlAttrPtr prop;
-    xmlDocPtr doc;
-    xmlNsPtr ns;
+    xmlAttrPtr prop = NULL;
+    xmlDocPtr doc = NULL;
+    xmlNsPtr ns = NULL;
     
     if (node == NULL)
         return(NULL);
 int
 domNodeNormalize( xmlNodePtr node )
 {
-    xmlNodePtr next;
+    xmlNodePtr next = NULL;
 
     if ( node == NULL ) 
         return(0);
 ProxyNodePtr
 PmmNewNode(xmlNodePtr node)
 {
-    ProxyNodePtr proxy;
+    ProxyNodePtr proxy = NULL;
 
     if ( node->_private == NULL ) {
         proxy = (ProxyNodePtr)malloc(sizeof(ProxyNode));
     else {
         proxy = (ProxyNodePtr)node->_private;
     }
+
     return proxy;
 }
 
 ProxyNodePtr
 PmmNewFragment(xmlDocPtr doc) 
 {
-    ProxyNodePtr retval;
+    ProxyNodePtr retval = NULL;
     xmlNodePtr frag = NULL;
 
     xs_warn("new frag\n");
 int
 PmmREFCNT_dec( ProxyNodePtr node ) 
 { 
-    xmlNodePtr libnode;
-    ProxyNodePtr owner; 
+    xmlNodePtr libnode = NULL;
+    ProxyNodePtr owner = NULL;  
     int retval = 0;
+
     if ( node ) {
         retval = PmmREFCNT(node)--;
         if ( PmmREFCNT(node) <= 0 ) {
 ProxyNodePtr
 PmmNewContext(xmlParserCtxtPtr node)
 {
-    ProxyNodePtr proxy;
+    ProxyNodePtr proxy = NULL;
 
     if ( node->_private == NULL ) {
         proxy = (ProxyNodePtr)malloc(sizeof(ProxyNode));
 PmmEncodeString( const char *encoding, const xmlChar *string ){
     xmlCharEncoding enc;
     xmlChar *ret = NULL;
-    xmlBufferPtr in, out;
+    xmlBufferPtr in = NULL, out = NULL;
     xmlCharEncodingHandlerPtr coder = NULL;
     
     if ( string != NULL ) {
 PmmDecodeString( const char *encoding, const xmlChar *string){
     char *ret=NULL;
     xmlCharEncoding enc;
-    xmlBufferPtr in, out;
+    xmlBufferPtr in = NULL, out = NULL;
     xmlCharEncodingHandlerPtr coder = NULL;
 
     if ( string != NULL ) {
     xmlChar *retval = NULL;
     xs_warn("sv2c start!");
     if ( scalar != NULL && scalar != &PL_sv_undef ) {
-        STRLEN len;
+        STRLEN len = 0;
         char * t_pv =SvPV(scalar, len);
-        xmlChar* ts;
+        xmlChar* ts = NULL;
         xmlChar* string = xmlStrdup((xmlChar*)t_pv);
         /* Safefree( t_pv ); */
         
 {
     /* this is a little helper function to avoid to much redundand
        code in LibXML.xs */
-    SV* retval;
+    SV* retval = &PL_sv_undef;
 
     if ( refnode != NULL ) {
         xmlDocPtr real_doc = refnode->doc;

perl-libxml-sax.c

     decl = xmlStrndup( name, len );
     
     if ( xmlStrcmp( "xmlns", decl ) != 0 ) {
-        pos= NULL;
+        pos = NULL;
     }
 
     xmlFree( decl );
             ns = PmmGetNsMapping( sax->ns_stack, prefix );
 
             hv_store(retval, "Prefix", 6,
-                     C2Sv(prefix, NULL), PrefixHash);
+                     sv_2mortal(C2Sv(prefix, NULL)), PrefixHash);
 
             if ( ns != NULL ) {
                 hv_store(retval, "NamespaceURI", 12,
-                         C2Sv(ns->href, NULL), NsURIHash);
+                         sv_2mortal(C2Sv(ns->href, NULL)), NsURIHash);
             } 
             else {
                 hv_store(retval, "NamespaceURI", 12,
             }
 
             hv_store(retval, "LocalName", 9,
-                     C2Sv(localname, NULL), LocalNameHash);
+                     sv_2mortal(C2Sv(localname, NULL)), LocalNameHash);
             
             xmlFree(localname);
             xmlFree(prefix);
             hv_store(retval, "NamespaceURI", 12,
                      SvREFCNT_inc(empty_sv), NsURIHash);
             hv_store(retval, "LocalName", 9,
-                     C2Sv(name, NULL), LocalNameHash);
+                     sv_2mortal(C2Sv(name, NULL)), LocalNameHash);
         }
                 
     }
     const xmlChar **ta = attr;
     const xmlChar * name = NULL;
     const xmlChar * value = NULL;
-    xmlChar * keyname;
+    xmlChar * keyname = NULL;
 
     if ( attr != NULL ) {
         while ( *ta != NULL ) {
                 const xmlChar * pos = PmmDetectNamespace( name );
 
                 hv_store(atV, "Name", 4,
-                         C2Sv(name, NULL), NameHash);
+                         sv_2mortal(C2Sv(name, NULL)), NameHash);
                 hv_store(atV, "Value", 5,
-                         C2Sv(value, NULL), ValueHash);
+                         sv_2mortal(C2Sv(value, NULL)), ValueHash);
                 
                 if ( pos != NULL ) {
                     xmlNsPtr ns = NULL;
                     ns = PmmGetNsMapping( sax->ns_stack, prefix );
             
                     hv_store(atV, "Prefix", 6,
-                             C2Sv(prefix, NULL), PrefixHash);
+                             sv_2mortal(C2Sv(prefix, NULL)), PrefixHash);
 
                     if ( ns != NULL ) {
                         nsURI = xmlStrdup( ns->href );
                         hv_store(atV, "NamespaceURI", 12,
-                                 C2Sv(ns->href, NULL), NsURIHash);
+                                 sv_2mortal(C2Sv(ns->href, NULL)), NsURIHash);
                     }
                     else {
                         hv_store(atV, "NamespaceURI", 12,
                     }
                     
                     hv_store(atV, "LocalName", 9,
-                             C2Sv(localname, NULL), LocalNameHash);
+                             sv_2mortal(C2Sv(localname, NULL)), LocalNameHash);
                     
                     xmlFree(prefix);
                 }
                     hv_store(atV, "NamespaceURI", 12,
                              SvREFCNT_inc(empty_sv), NsURIHash);
                     hv_store(atV, "LocalName", 9,
-                             C2Sv(name, NULL), LocalNameHash);            
+                             sv_2mortal(C2Sv(name, NULL)), LocalNameHash);            
                 }
             }
             
 
     if ( data != NULL && xmlStrlen( data ) ) {
         hv_store(retval, "Data", 4,
-                 C2Sv(data, NULL), DataHash);
+                 sv_2mortal(C2Sv(data, NULL)), DataHash);
     }
 
     return retval;
 
     if ( target != NULL && xmlStrlen( target ) ) {
         hv_store(retval, "Target", 6,
-                 C2Sv(data, NULL), TargetHash);
+                 sv_2mortal(C2Sv(data, NULL)), TargetHash);
 
         if ( data != NULL && xmlStrlen( data ) ) {
             hv_store(retval, "Data", 4,
-                     C2Sv(data, NULL), DataHash);
+                     sv_2mortal(C2Sv(data, NULL)), DataHash);
         }
         else {
             hv_store(retval, "Data", 4,
-                     C2Sv("", NULL), DataHash);
+                     sv_2mortal(C2Sv("", NULL)), DataHash);
         }
     }
 
     PUSHMARK(SP) ;
     XPUSHs(sax->parser);
 
-    XPUSHs(svMessage);
+    XPUSHs(sv_2mortal(svMessage));
     XPUSHs(sv_2mortal(newSViv(ctxt->input->line)));
     XPUSHs(sv_2mortal(newSViv(ctxt->input->col)));
 
     PUSHMARK(SP) ;
     XPUSHs(sax->parser);
 
-    XPUSHs(svMessage);
+    XPUSHs(sv_2mortal(svMessage));
     XPUSHs(sv_2mortal(newSViv(ctxt->input->line)));
     XPUSHs(sv_2mortal(newSViv(ctxt->input->col)));
     PUTBACK;
     PUSHMARK(SP) ;
     XPUSHs(sax->parser);
 
-    XPUSHs(svMessage);
+    XPUSHs(sv_2mortal(svMessage));
     XPUSHs(sv_2mortal(newSViv(ctxt->input->line)));
     XPUSHs(sv_2mortal(newSViv(ctxt->input->col)));
     PUTBACK;