* xmlRaiseMemoryError: * @schannel: the structured callback channel * @channel: the old callback channel * @data: the callback data * @domain: the domain for the error * @error: optional error struct to be filled * * Update the global and optional error structure, then forward the * error to an error handler. * * This function doesn't make memory allocations which are likely * to fail a
| 632 | * to fail after an OOM error. |
| 633 | */ |
| 634 | void |
| 635 | xmlRaiseMemoryError(xmlStructuredErrorFunc schannel, xmlGenericErrorFunc channel, |
| 636 | void *data, int domain, xmlError *error) |
| 637 | { |
| 638 | xmlError *lastError = &xmlLastError; |
| 639 | |
| 640 | xmlResetLastError(); |
| 641 | lastError->domain = domain; |
| 642 | lastError->code = XML_ERR_NO_MEMORY; |
| 643 | lastError->level = XML_ERR_FATAL; |
| 644 | |
| 645 | if (error != NULL) { |
| 646 | xmlResetError(error); |
| 647 | error->domain = domain; |
| 648 | error->code = XML_ERR_NO_MEMORY; |
| 649 | error->level = XML_ERR_FATAL; |
| 650 | } |
| 651 | |
| 652 | if (schannel != NULL) { |
| 653 | schannel(data, lastError); |
| 654 | } else if (xmlStructuredError != NULL) { |
| 655 | xmlStructuredError(xmlStructuredErrorContext, lastError); |
| 656 | } else if (channel != NULL) { |
| 657 | channel(data, "libxml2: out of memory\n"); |
| 658 | } |
| 659 | } |
| 660 | |
| 661 | /** |
| 662 | * xmlVRaiseError: |
no test coverage detected