fix a bug not detecting cross entity comments probably when comment

* parser.c: fix a bug not detecting cross entity comments probably
  when comment parsing got optimized.
* Makefile.am: add make check
* runxmlconf.c: fix the log file name
Daniel

svn path=/trunk/; revision=3758
diff --git a/ChangeLog b/ChangeLog
index f6b0175..e7be21b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Jul 29 18:43:07 CEST 2008 Daniel Veillard <daniel@veillard.com>
+
+	* parser.c: fix a bug not detecting cross entity comments probably
+	  when comment parsing got optimized.
+	* Makefile.am: add make check
+	* runxmlconf.c: fix the log file name
+
 Tue Jul 29 18:09:26 CEST 2008 Daniel Veillard <daniel@veillard.com>
 
 	* runxmlconf.c Makefile.am: add a C program to run the W3C test
diff --git a/Makefile.am b/Makefile.am
index 6324c53..5ba123b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -166,7 +166,10 @@
 #testOOM_DEPENDENCIES = $(DEPS)
 #testOOM_LDADD= $(LDADDS)
 
-check-local: all tests
+runtests:
+	runtest$(EXEEXT) && testapi$(EXEEXT) && runxmlconf$(EXEEXT)
+
+check-local: all runtests
 
 testall : tests SVGtests SAXtests
 
diff --git a/parser.c b/parser.c
index 4966560..c8dc2ab 100644
--- a/parser.c
+++ b/parser.c
@@ -4203,8 +4203,10 @@
     int q, ql;
     int r, rl;
     int cur, l;
-    xmlParserInputPtr input = ctxt->input;
     int count = 0;
+    int inputid;
+
+    inputid = ctxt->input->id;
 
     if (buf == NULL) {
         len = 0;
@@ -4286,7 +4288,7 @@
                           "xmlParseComment: invalid xmlChar value %d\n",
 	                  cur);
     } else {
-	if (input != ctxt->input) {
+	if (inputid != ctxt->input->id) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
 		"Comment doesn't start and stop in the same entity\n");
 	}
@@ -4322,15 +4324,16 @@
     xmlParserInputState state;
     const xmlChar *in;
     int nbchar = 0, ccol;
+    int inputid;
 
     /*
      * Check that there is a comment right here.
      */
     if ((RAW != '<') || (NXT(1) != '!') ||
         (NXT(2) != '-') || (NXT(3) != '-')) return;
-
     state = ctxt->instate;
     ctxt->instate = XML_PARSER_COMMENT;
+    inputid = ctxt->input->id;
     SKIP(4);
     SHRINK;
     GROW;
@@ -4421,6 +4424,10 @@
 	if (*in == '-') {
 	    if (in[1] == '-') {
 	        if (in[2] == '>') {
+		    if (ctxt->input->id != inputid) {
+			xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
+			"comment doesn't start and stop in the same entity\n");
+		    }
 		    SKIP(3);
 		    if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) &&
 		        (!ctxt->disableSAX)) {
diff --git a/runxmlconf.c b/runxmlconf.c
index b2bd935..e5efc6b 100644
--- a/runxmlconf.c
+++ b/runxmlconf.c
@@ -29,7 +29,7 @@
 #include <libxml/xpath.h>
 #include <libxml/xpathInternals.h>
 
-#define LOGFILE "runsuite.log"
+#define LOGFILE "runxmlconf.log"
 static FILE *logfile = NULL;
 static int verbose = 0;