* xmlNewStreamCtxt: * @size: the number of expected states * * build a new stream context * * Returns the new structure or NULL in case of error. */
| 1683 | * Returns the new structure or NULL in case of error. |
| 1684 | */ |
| 1685 | static xmlStreamCtxtPtr |
| 1686 | xmlNewStreamCtxt(xmlStreamCompPtr stream) { |
| 1687 | xmlStreamCtxtPtr cur; |
| 1688 | |
| 1689 | cur = (xmlStreamCtxtPtr) xmlMalloc(sizeof(xmlStreamCtxt)); |
| 1690 | if (cur == NULL) { |
| 1691 | ERROR(NULL, NULL, NULL, |
| 1692 | "xmlNewStreamCtxt: malloc failed\n"); |
| 1693 | return(NULL); |
| 1694 | } |
| 1695 | memset(cur, 0, sizeof(xmlStreamCtxt)); |
| 1696 | cur->states = (int *) xmlMalloc(4 * 2 * sizeof(int)); |
| 1697 | if (cur->states == NULL) { |
| 1698 | xmlFree(cur); |
| 1699 | ERROR(NULL, NULL, NULL, |
| 1700 | "xmlNewStreamCtxt: malloc failed\n"); |
| 1701 | return(NULL); |
| 1702 | } |
| 1703 | cur->nbState = 0; |
| 1704 | cur->maxState = 4; |
| 1705 | cur->level = 0; |
| 1706 | cur->comp = stream; |
| 1707 | cur->blockLevel = -1; |
| 1708 | return(cur); |
| 1709 | } |
| 1710 | |
| 1711 | /** |
| 1712 | * xmlFreeStreamCtxt: |
no outgoing calls
no test coverage detected