* xmlBufFromBuffer: * @buffer: incoming old buffer to convert to a new one * * Helper routine to switch from the old buffer structures in use * in various APIs. It creates a wrapper xmlBufPtr which will be * used for internal processing until the xmlBufBackToBuffer() is * issued. * * Returns a new xmlBufPtr unless the call failed and NULL is returned */
| 830 | * Returns a new xmlBufPtr unless the call failed and NULL is returned |
| 831 | */ |
| 832 | xmlBufPtr |
| 833 | xmlBufFromBuffer(xmlBufferPtr buffer) { |
| 834 | xmlBufPtr ret; |
| 835 | |
| 836 | if (buffer == NULL) |
| 837 | return(NULL); |
| 838 | |
| 839 | ret = (xmlBufPtr) xmlMalloc(sizeof(xmlBuf)); |
| 840 | if (ret == NULL) { |
| 841 | return(NULL); |
| 842 | } |
| 843 | ret->use = buffer->use; |
| 844 | ret->size = buffer->size; |
| 845 | UPDATE_COMPAT(ret); |
| 846 | ret->error = 0; |
| 847 | ret->buffer = buffer; |
| 848 | ret->alloc = buffer->alloc; |
| 849 | ret->content = buffer->content; |
| 850 | ret->contentIO = buffer->contentIO; |
| 851 | |
| 852 | return(ret); |
| 853 | } |
| 854 | |
| 855 | /** |
| 856 | * xmlBufBackToBuffer: |
no outgoing calls
no test coverage detected