summaryrefslogtreecommitdiff
path: root/parserInternals.c
diff options
context:
space:
mode:
authorAron Xu <aron@debian.org>2012-05-25 04:03:35 +0000
committerAron Xu <aron@debian.org>2012-05-25 04:03:35 +0000
commitd7372d053bbd1d58216fbb04d1771ffa4cc3e624 (patch)
tree62b661911406394bbeaca8951d660bb6d8aac0de /parserInternals.c
parent2d1849b271fa8697b88d07ba7d78dc83591e1363 (diff)
downloadlibxml2-upstream/2.8.0+dfsg1.tar.gz
Imported Upstream version 2.8.0+dfsg1upstream/2.8.0+dfsg1
Diffstat (limited to 'parserInternals.c')
-rw-r--r--parserInternals.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/parserInternals.c b/parserInternals.c
index 2404ddf..746b7fd 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -1372,13 +1372,13 @@ xmlFreeInputStream(xmlParserInputPtr input) {
* xmlNewInputStream:
* @ctxt: an XML parser context
*
- * Create a new input stream structure
+ * Create a new input stream structure.
+ *
* Returns the new input stream or NULL
*/
xmlParserInputPtr
xmlNewInputStream(xmlParserCtxtPtr ctxt) {
xmlParserInputPtr input;
- static int id = 0;
input = (xmlParserInputPtr) xmlMalloc(sizeof(xmlParserInput));
if (input == NULL) {
@@ -1389,11 +1389,15 @@ xmlNewInputStream(xmlParserCtxtPtr ctxt) {
input->line = 1;
input->col = 1;
input->standalone = -1;
+
/*
- * we don't care about thread reentrancy unicity for a single
- * parser context (and hence thread) is sufficient.
+ * If the context is NULL the id cannot be initialized, but that
+ * should not happen while parsing which is the situation where
+ * the id is actually needed.
*/
- input->id = id++;
+ if (ctxt != NULL)
+ input->id = ctxt->input_id++;
+
return(input);
}
@@ -1757,6 +1761,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
ctxt->charset = XML_CHAR_ENCODING_UTF8;
ctxt->catalogs = NULL;
ctxt->nbentities = 0;
+ ctxt->input_id = 1;
xmlInitNodeInfoSeq(&ctxt->node_seq);
return(0);
}