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

Function xmlStreamCtxtAddState

ThirdParty/libxml2/vtklibxml2/pattern.c:1739–1765  ·  view source on GitHub ↗

* xmlStreamCtxtAddState: * @comp: the stream context * @idx: the step index for that streaming state * * Add a new state to the stream context * * Returns -1 in case of error or the state index if successful */

Source from the content-addressed store, hash-verified

1737 * Returns -1 in case of error or the state index if successful
1738 */
1739static int
1740xmlStreamCtxtAddState(xmlStreamCtxtPtr comp, int idx, int level) {
1741 int i;
1742 for (i = 0;i < comp->nbState;i++) {
1743 if (comp->states[2 * i] < 0) {
1744 comp->states[2 * i] = idx;
1745 comp->states[2 * i + 1] = level;
1746 return(i);
1747 }
1748 }
1749 if (comp->nbState >= comp->maxState) {
1750 int *cur;
1751
1752 cur = (int *) xmlRealloc(comp->states,
1753 comp->maxState * 4 * sizeof(int));
1754 if (cur == NULL) {
1755 ERROR(NULL, NULL, NULL,
1756 "xmlNewStreamCtxt: malloc failed\n");
1757 return(-1);
1758 }
1759 comp->states = cur;
1760 comp->maxState *= 2;
1761 }
1762 comp->states[2 * comp->nbState] = idx;
1763 comp->states[2 * comp->nbState++ + 1] = level;
1764 return(comp->nbState - 1);
1765}
1766
1767/**
1768 * xmlStreamPushInternal:

Callers 2

xmlStreamPushInternalFunction · 0.85
ifFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected