MCPcopy Create free account
hub / github.com/Kitware/VTK / htmlInitParserCtxt

Function htmlInitParserCtxt

ThirdParty/libxml2/vtklibxml2/HTMLparser.c:4871–4944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4869 */
4870
4871static int
4872htmlInitParserCtxt(htmlParserCtxtPtr ctxt, const htmlSAXHandler *sax,
4873 void *userData)
4874{
4875 if (ctxt == NULL) return(-1);
4876 memset(ctxt, 0, sizeof(htmlParserCtxt));
4877
4878 ctxt->dict = xmlDictCreate();
4879 if (ctxt->dict == NULL)
4880 return(-1);
4881
4882 if (ctxt->sax == NULL)
4883 ctxt->sax = (htmlSAXHandler *) xmlMalloc(sizeof(htmlSAXHandler));
4884 if (ctxt->sax == NULL)
4885 return(-1);
4886 if (sax == NULL) {
4887 memset(ctxt->sax, 0, sizeof(htmlSAXHandler));
4888 xmlSAX2InitHtmlDefaultSAXHandler(ctxt->sax);
4889 ctxt->userData = ctxt;
4890 } else {
4891 memcpy(ctxt->sax, sax, sizeof(htmlSAXHandler));
4892 ctxt->userData = userData ? userData : ctxt;
4893 }
4894
4895 /* Allocate the Input stack */
4896 ctxt->inputTab = (htmlParserInputPtr *)
4897 xmlMalloc(5 * sizeof(htmlParserInputPtr));
4898 if (ctxt->inputTab == NULL)
4899 return(-1);
4900 ctxt->inputNr = 0;
4901 ctxt->inputMax = 5;
4902 ctxt->input = NULL;
4903 ctxt->version = NULL;
4904 ctxt->encoding = NULL;
4905 ctxt->standalone = -1;
4906 ctxt->instate = XML_PARSER_START;
4907
4908 /* Allocate the Node stack */
4909 ctxt->nodeTab = (htmlNodePtr *) xmlMalloc(10 * sizeof(htmlNodePtr));
4910 if (ctxt->nodeTab == NULL)
4911 return(-1);
4912 ctxt->nodeNr = 0;
4913 ctxt->nodeMax = 10;
4914 ctxt->node = NULL;
4915
4916 /* Allocate the Name stack */
4917 ctxt->nameTab = (const xmlChar **) xmlMalloc(10 * sizeof(xmlChar *));
4918 if (ctxt->nameTab == NULL)
4919 return(-1);
4920 ctxt->nameNr = 0;
4921 ctxt->nameMax = 10;
4922 ctxt->name = NULL;
4923
4924 ctxt->nodeInfoTab = NULL;
4925 ctxt->nodeInfoNr = 0;
4926 ctxt->nodeInfoMax = 0;
4927
4928 ctxt->myDoc = NULL;

Callers 1

htmlNewSAXParserCtxtFunction · 0.85

Calls 3

xmlDictCreateFunction · 0.85
xmlInitNodeInfoSeqFunction · 0.85

Tested by

no test coverage detected