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

Function xmlParseConditionalSections

ThirdParty/libxml2/vtklibxml2/parser.c:6986–7106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6984 */
6985
6986static void
6987xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
6988 int *inputIds = NULL;
6989 size_t inputIdsSize = 0;
6990 size_t depth = 0;
6991
6992 while (PARSER_STOPPED(ctxt) == 0) {
6993 if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
6994 int id = ctxt->input->id;
6995
6996 SKIP(3);
6997 SKIP_BLANKS_PE;
6998
6999 if (CMP7(CUR_PTR, 'I', 'N', 'C', 'L', 'U', 'D', 'E')) {
7000 SKIP(7);
7001 SKIP_BLANKS_PE;
7002 if (RAW != '[') {
7003 xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
7004 xmlHaltParser(ctxt);
7005 goto error;
7006 }
7007 if (ctxt->input->id != id) {
7008 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
7009 "All markup of the conditional section is"
7010 " not in the same entity\n");
7011 }
7012 NEXT;
7013
7014 if (inputIdsSize <= depth) {
7015 int *tmp;
7016
7017 inputIdsSize = (inputIdsSize == 0 ? 4 : inputIdsSize * 2);
7018 tmp = (int *) xmlRealloc(inputIds,
7019 inputIdsSize * sizeof(int));
7020 if (tmp == NULL) {
7021 xmlErrMemory(ctxt);
7022 goto error;
7023 }
7024 inputIds = tmp;
7025 }
7026 inputIds[depth] = id;
7027 depth++;
7028 } else if (CMP6(CUR_PTR, 'I', 'G', 'N', 'O', 'R', 'E')) {
7029 size_t ignoreDepth = 0;
7030
7031 SKIP(6);
7032 SKIP_BLANKS_PE;
7033 if (RAW != '[') {
7034 xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
7035 xmlHaltParser(ctxt);
7036 goto error;
7037 }
7038 if (ctxt->input->id != id) {
7039 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
7040 "All markup of the conditional section is"
7041 " not in the same entity\n");
7042 }
7043 NEXT;

Callers 2

xmlParseExternalSubsetFunction · 0.85
xmlParseInternalSubsetFunction · 0.85

Calls 4

xmlFatalErrFunction · 0.85
xmlHaltParserFunction · 0.85
xmlErrMemoryFunction · 0.85
xmlParseMarkupDeclFunction · 0.85

Tested by

no test coverage detected