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

Function xmlNewStreamComp

ThirdParty/libxml2/vtklibxml2/pattern.c:1420–1444  ·  view source on GitHub ↗

* xmlNewStreamComp: * @size: the number of expected steps * * build a new compiled pattern for streaming * * Returns the new structure or NULL in case of error. */

Source from the content-addressed store, hash-verified

1418 * Returns the new structure or NULL in case of error.
1419 */
1420static xmlStreamCompPtr
1421xmlNewStreamComp(int size) {
1422 xmlStreamCompPtr cur;
1423
1424 if (size < 4)
1425 size = 4;
1426
1427 cur = (xmlStreamCompPtr) xmlMalloc(sizeof(xmlStreamComp));
1428 if (cur == NULL) {
1429 ERROR(NULL, NULL, NULL,
1430 "xmlNewStreamComp: malloc failed\n");
1431 return(NULL);
1432 }
1433 memset(cur, 0, sizeof(xmlStreamComp));
1434 cur->steps = (xmlStreamStepPtr) xmlMalloc(size * sizeof(xmlStreamStep));
1435 if (cur->steps == NULL) {
1436 xmlFree(cur);
1437 ERROR(NULL, NULL, NULL,
1438 "xmlNewStreamComp: malloc failed\n");
1439 return(NULL);
1440 }
1441 cur->nbStep = 0;
1442 cur->maxStep = size;
1443 return(cur);
1444}
1445
1446/**
1447 * xmlFreeStreamComp:

Callers 1

xmlStreamCompileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected