libxml2 r3773 - in trunk: . include/libxml



Author: veillard
Date: Mon Aug 25 08:57:48 2008
New Revision: 3773
URL: http://svn.gnome.org/viewvc/libxml2?rev=3773&view=rev

Log:
* include/libxml/entities.h entities.c SAX2.c parser.c: rework
  the patch to avoid some ABI issue with people allocating
  entities structure directly
Daniel


Modified:
   trunk/ChangeLog
   trunk/SAX2.c
   trunk/entities.c
   trunk/include/libxml/entities.h
   trunk/parser.c

Modified: trunk/SAX2.c
==============================================================================
--- trunk/SAX2.c	(original)
+++ trunk/SAX2.c	Mon Aug 25 08:57:48 2008
@@ -580,7 +580,8 @@
 	    return(NULL);
 	}
 	ret->owner = 1;
-	ret->checked = 1;
+	if (ret->checked == 0)
+	    ret->checked = 1;
     }
     return(ret);
 }

Modified: trunk/entities.c
==============================================================================
--- trunk/entities.c	(original)
+++ trunk/entities.c	Mon Aug 25 08:57:48 2008
@@ -31,35 +31,35 @@
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "<", BAD_CAST "<", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1, 0
+    NULL, NULL, NULL, NULL, 0, 1
 };
 static xmlEntity xmlEntityGt = {
     NULL, XML_ENTITY_DECL, BAD_CAST "gt",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST ">", BAD_CAST ">", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1, 0
+    NULL, NULL, NULL, NULL, 0, 1
 };
 static xmlEntity xmlEntityAmp = {
     NULL, XML_ENTITY_DECL, BAD_CAST "amp",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "&", BAD_CAST "&", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1, 0
+    NULL, NULL, NULL, NULL, 0, 1
 };
 static xmlEntity xmlEntityQuot = {
     NULL, XML_ENTITY_DECL, BAD_CAST "quot",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "\"", BAD_CAST "\"", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1, 0
+    NULL, NULL, NULL, NULL, 0, 1
 };
 static xmlEntity xmlEntityApos = {
     NULL, XML_ENTITY_DECL, BAD_CAST "apos",
     NULL, NULL, NULL, NULL, NULL, NULL, 
     BAD_CAST "'", BAD_CAST "'", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1, 0
+    NULL, NULL, NULL, NULL, 0, 1
 };
 
 /**

Modified: trunk/include/libxml/entities.h
==============================================================================
--- trunk/include/libxml/entities.h	(original)
+++ trunk/include/libxml/entities.h	Mon Aug 25 08:57:48 2008
@@ -57,7 +57,6 @@
     const xmlChar           *URI;	/* the full URI as computed */
     int                    owner;	/* does the entity own the childrens */
     int			 checked;	/* was the entity content checked */
-    unsigned long     nbentities;	/* the number of entities references */
 };
 
 /*

Modified: trunk/parser.c
==============================================================================
--- trunk/parser.c	(original)
+++ trunk/parser.c	Mon Aug 25 08:57:48 2008
@@ -2421,7 +2421,7 @@
 	        goto int_error;
 	    ctxt->nbentities++;
 	    if (ent != NULL)
-	        ctxt->nbentities += ent->nbentities;
+	        ctxt->nbentities += ent->checked;
 	    if ((ent != NULL) &&
 		(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
 		if (ent->content != NULL) {
@@ -2471,7 +2471,7 @@
 	        goto int_error;
 	    ctxt->nbentities++;
 	    if (ent != NULL)
-	        ctxt->nbentities += ent->nbentities;
+	        ctxt->nbentities += ent->checked;
 	    if (ent != NULL) {
                 if (ent->content == NULL) {
 		    if (xmlLoadEntityContent(ctxt, ent) < 0) {
@@ -3555,7 +3555,7 @@
 		ent = xmlParseEntityRef(ctxt);
 		ctxt->nbentities++;
 		if (ent != NULL)
-		    ctxt->nbentities += ent->nbentities;
+		    ctxt->nbentities += ent->checked;
 		if ((ent != NULL) &&
 		    (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
 		    if (len > buf_size - 10) {
@@ -5083,7 +5083,7 @@
 		}
 	    }
             if (cur != NULL) {
-	        cur->nbentities = ctxt->nbentities - oldnbent;
+	        cur->checked = ctxt->nbentities - oldnbent;
 	        if (cur->orig != NULL)
 		    xmlFree(orig);
 		else
@@ -6594,7 +6594,7 @@
 			xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR,
 				     "invalid entity type found\n", NULL);
 		    }
-		    ent->nbentities = ctxt->nbentities - oldnbent;
+		    ent->checked = ctxt->nbentities - oldnbent;
 		    if (ret == XML_ERR_ENTITY_LOOP) {
 			xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
 			return;
@@ -6651,9 +6651,10 @@
 			list = NULL;
 		    }
 		}
-		ent->checked = 1;
+		if (ent->checked == 0)
+		    ent->checked = 1;
 	    }
-	    ctxt->nbentities += ent->nbentities;
+	    ctxt->nbentities += ent->checked;
 
             if (ent->children == NULL) {
 		/*
@@ -6662,7 +6663,7 @@
 		 * though parsing for first checking go though the entity
 		 * content to generate callbacks associated to the entity
 		 */
-		if (was_checked == 1) {
+		if (was_checked != 0) {
 		    void *user_data;
 		    /*
 		     * This is a bit hackish but this seems the best



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]