* xmlNewInputStream: * @ctxt: an XML parser context * * Create a new input stream structure. * * Returns the new input stream or NULL */
| 1519 | * Returns the new input stream or NULL |
| 1520 | */ |
| 1521 | xmlParserInputPtr |
| 1522 | xmlNewInputStream(xmlParserCtxtPtr ctxt) { |
| 1523 | xmlParserInputPtr input; |
| 1524 | |
| 1525 | input = (xmlParserInputPtr) xmlMalloc(sizeof(xmlParserInput)); |
| 1526 | if (input == NULL) { |
| 1527 | xmlCtxtErrMemory(ctxt); |
| 1528 | return(NULL); |
| 1529 | } |
| 1530 | memset(input, 0, sizeof(xmlParserInput)); |
| 1531 | input->line = 1; |
| 1532 | input->col = 1; |
| 1533 | |
| 1534 | /* |
| 1535 | * If the context is NULL the id cannot be initialized, but that |
| 1536 | * should not happen while parsing which is the situation where |
| 1537 | * the id is actually needed. |
| 1538 | */ |
| 1539 | if (ctxt != NULL) { |
| 1540 | if (input->id >= INT_MAX) { |
| 1541 | xmlCtxtErrMemory(ctxt); |
| 1542 | return(NULL); |
| 1543 | } |
| 1544 | input->id = ctxt->input_id++; |
| 1545 | } |
| 1546 | |
| 1547 | return(input); |
| 1548 | } |
| 1549 | |
| 1550 | /** |
| 1551 | * xmlNewInputURL: |
no test coverage detected