* xmlNewStreamComp: * @size: the number of expected steps * * build a new compiled pattern for streaming * * Returns the new structure or NULL in case of error. */
| 1418 | * Returns the new structure or NULL in case of error. |
| 1419 | */ |
| 1420 | static xmlStreamCompPtr |
| 1421 | xmlNewStreamComp(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: |