fix a small initialization problem raised by Ashwin increase testing

* threads.c: fix a small initialization problem raised by Ashwin
* testapi.c gentest.py: increase testing especially for document
  with an internal subset, and entities
* tree.c: fix a deallocation issue when unlinking entities from
  a document.
* valid.c: fix a missing entry point test not found previously.
* doc/*: regenerated the APIs, docs etc.
daniel

svn path=/trunk/; revision=3778
diff --git a/valid.c b/valid.c
index 594d383..49fb720 100644
--- a/valid.c
+++ b/valid.c
@@ -6786,7 +6786,7 @@
     xmlAttributeTablePtr table;
     xmlEntitiesTablePtr entities;
 
-    if (doc == NULL) return(0);
+    if ((doc == NULL) || (ctxt == NULL)) return(0);
     if ((doc->intSubset == NULL) && (doc->extSubset == NULL))
 	return(0);
     ctxt->doc = doc;