From efd14b3fa80f70de0deae1f100ec20fe3efdd6c2 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Fri, 24 Apr 2026 17:39:16 +0200 Subject: [PATCH] change libxml backword compatibility defines --- src/CMakeLists.txt | 6 +++--- src/xml.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a8c7049..12bf112 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,9 +7,9 @@ include(GNUInstallDirs) find_package(LibXml2 REQUIRED) message(STATUS "find LibXml2: " ${LIBXML2_LIBRARY}) -if(${LIBXML2_VERSION_STRING} VERSION_GREATER_EQUAL 2.10) - message(STATUS "define LIBXML2_10") - add_compile_definitions(LIBXML2_10) +if(${LIBXML2_VERSION_STRING} VERSION_LESS 2.10) + message(STATUS "define LIBXML_BEFORE_2_10") + add_compile_definitions(LIBXML_BEFORE_2_10) endif() message(STATUS "CMAKE_INSTALL_PREFIX " ${CMAKE_INSTALL_PREFIX}) diff --git a/src/xml.c b/src/xml.c index 20af6c5..46fc164 100644 --- a/src/xml.c +++ b/src/xml.c @@ -295,11 +295,11 @@ void init_time_acount(const uint8_t hour, const uint8_t min) xmlFreeTextWriter(xmlWriter); xmlWriter = NULL; -#ifdef LIBXML2_10 - xmlCleanupParser(); -#else +#ifdef LIBXML_BEFORE_2_10 xmlDictCleanup(); xmlCleanupCharEncodingHandlers(); +#else + xmlCleanupParser(); #endif free(xmlElemContent); @@ -356,11 +356,11 @@ void add_entry(const char* date, xmlFreeTextReader(xmlreader); xmlreader = NULL; -#ifdef LIBXML2_10 - xmlCleanupParser(); -#else +#ifdef LIBXML_BEFORE_2_10 xmlCleanupCharEncodingHandlers(); xmlDictCleanup(); +#else + xmlCleanupParser(); #endif _free_mem(file_content); @@ -425,11 +425,11 @@ void merge(const char* dir) xmlFreeTextWriter(xmlwriter); xmlwriter = NULL; -#ifdef LIBXML2_10 - xmlCleanupParser(); -#else +#ifdef LIBXML_BEFORE_2_10 xmlCleanupCharEncodingHandlers(); xmlDictCleanup(); +#else + xmlCleanupParser(); #endif free(xmlElemContent); -- 2.47.3