Remove obsolete libxml2 code

LIBXML2_NEW_BUFFER is always defined since libxml2 2.9.0.
That's the minimum version PHP requires, so it will always be defined.
This commit is contained in:
Niels Dossche 2023-09-09 21:57:02 +02:00
parent 518233c39d
commit 0ea268b51a
3 changed files with 0 additions and 17 deletions

View file

@ -175,11 +175,7 @@ zend_result dom_documenttype_internal_subset_read(dom_object *obj, zval *retval)
xmlNodeDumpOutput (buff, NULL, cur, 0, 0, NULL); xmlNodeDumpOutput (buff, NULL, cur, 0, 0, NULL);
xmlOutputBufferFlush(buff); xmlOutputBufferFlush(buff);
#ifdef LIBXML2_NEW_BUFFER
smart_str_appendl(&ret_buf, (const char *) xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff)); smart_str_appendl(&ret_buf, (const char *) xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff));
#else
smart_str_appendl(&ret_buf, (char *) buff->buffer->content, buff->buffer->use);
#endif
(void)xmlOutputBufferClose(buff); (void)xmlOutputBufferClose(buff);
} }

View file

@ -1891,17 +1891,9 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
RETVAL_FALSE; RETVAL_FALSE;
} else { } else {
if (mode == 0) { if (mode == 0) {
#ifdef LIBXML2_NEW_BUFFER
ret = xmlOutputBufferGetSize(buf); ret = xmlOutputBufferGetSize(buf);
#else
ret = buf->buffer->use;
#endif
if (ret > 0) { if (ret > 0) {
#ifdef LIBXML2_NEW_BUFFER
RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret); RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret);
#else
RETVAL_STRINGL((char *) buf->buffer->content, ret);
#endif
} else { } else {
RETVAL_EMPTY_STRING(); RETVAL_EMPTY_STRING();
} }

View file

@ -1432,13 +1432,8 @@ PHP_METHOD(SimpleXMLElement, asXML)
xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding); xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding);
xmlOutputBufferFlush(outbuf); xmlOutputBufferFlush(outbuf);
#ifdef LIBXML2_NEW_BUFFER
return_content = (char *)xmlOutputBufferGetContent(outbuf); return_content = (char *)xmlOutputBufferGetContent(outbuf);
return_len = xmlOutputBufferGetSize(outbuf); return_len = xmlOutputBufferGetSize(outbuf);
#else
return_content = (char *)outbuf->buffer->content;
return_len = outbuf->buffer->use;
#endif
if (!return_content) { if (!return_content) {
RETVAL_FALSE; RETVAL_FALSE;
} else { } else {