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

Function xmlRegAtomAddRange

ThirdParty/libxml2/vtklibxml2/xmlregexp.c:1167–1209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1165 ************************************************************************/
1166
1167static xmlRegRangePtr
1168xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom,
1169 int neg, xmlRegAtomType type, int start, int end,
1170 xmlChar *blockName) {
1171 xmlRegRangePtr range;
1172
1173 if (atom == NULL) {
1174 ERROR("add range: atom is NULL");
1175 return(NULL);
1176 }
1177 if (atom->type != XML_REGEXP_RANGES) {
1178 ERROR("add range: atom is not ranges");
1179 return(NULL);
1180 }
1181 if (atom->maxRanges == 0) {
1182 atom->maxRanges = 4;
1183 atom->ranges = (xmlRegRangePtr *) xmlMalloc(atom->maxRanges *
1184 sizeof(xmlRegRangePtr));
1185 if (atom->ranges == NULL) {
1186 xmlRegexpErrMemory(ctxt);
1187 atom->maxRanges = 0;
1188 return(NULL);
1189 }
1190 } else if (atom->nbRanges >= atom->maxRanges) {
1191 xmlRegRangePtr *tmp;
1192 atom->maxRanges *= 2;
1193 tmp = (xmlRegRangePtr *) xmlRealloc(atom->ranges, atom->maxRanges *
1194 sizeof(xmlRegRangePtr));
1195 if (tmp == NULL) {
1196 xmlRegexpErrMemory(ctxt);
1197 atom->maxRanges /= 2;
1198 return(NULL);
1199 }
1200 atom->ranges = tmp;
1201 }
1202 range = xmlRegNewRange(ctxt, neg, type, start, end);
1203 if (range == NULL)
1204 return(NULL);
1205 range->blockName = blockName;
1206 atom->ranges[atom->nbRanges++] = range;
1207
1208 return(range);
1209}
1210
1211static int
1212xmlRegGetCounter(xmlRegParserCtxtPtr ctxt) {

Callers 3

xmlFAParseCharPropFunction · 0.85
xmlFAParseCharClassEscFunction · 0.85
xmlFAParseCharRangeFunction · 0.85

Calls 2

xmlRegexpErrMemoryFunction · 0.85
xmlRegNewRangeFunction · 0.85

Tested by

no test coverage detected