From 0ea268b51aab770e3c651fd989b5632cb06ba6b6 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sat, 9 Sep 2023 21:57:02 +0200 Subject: [PATCH] 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. --- ext/dom/documenttype.c | 4 ---- ext/dom/node.c | 8 -------- ext/simplexml/simplexml.c | 5 ----- 3 files changed, 17 deletions(-) diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c index c85f0c3ad37..5e23d57be8a 100644 --- a/ext/dom/documenttype.c +++ b/ext/dom/documenttype.c @@ -175,11 +175,7 @@ zend_result dom_documenttype_internal_subset_read(dom_object *obj, zval *retval) xmlNodeDumpOutput (buff, NULL, cur, 0, 0, NULL); xmlOutputBufferFlush(buff); -#ifdef LIBXML2_NEW_BUFFER 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); } diff --git a/ext/dom/node.c b/ext/dom/node.c index 144181c6791..9bcf8384e58 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -1891,17 +1891,9 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ RETVAL_FALSE; } else { if (mode == 0) { -#ifdef LIBXML2_NEW_BUFFER ret = xmlOutputBufferGetSize(buf); -#else - ret = buf->buffer->use; -#endif if (ret > 0) { -#ifdef LIBXML2_NEW_BUFFER RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret); -#else - RETVAL_STRINGL((char *) buf->buffer->content, ret); -#endif } else { RETVAL_EMPTY_STRING(); } diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 052be0c5cc7..a4e5800d75a 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1432,13 +1432,8 @@ PHP_METHOD(SimpleXMLElement, asXML) xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding); xmlOutputBufferFlush(outbuf); -#ifdef LIBXML2_NEW_BUFFER return_content = (char *)xmlOutputBufferGetContent(outbuf); return_len = xmlOutputBufferGetSize(outbuf); -#else - return_content = (char *)outbuf->buffer->content; - return_len = outbuf->buffer->use; -#endif if (!return_content) { RETVAL_FALSE; } else {