Skip to content

Commit 2f6b74b

Browse files
committed
Refactor: libcrmcommon: Drop xmlSetBufferAllocationScheme() call
As of libxml v2.14.0, xmlSetBufferAllocationScheme() is deprecated, which is already causing compilation failures on debian-experimental. Further, also as of libxml v2.14.0, its replacement xmlBufferSetAllocationScheme() is a no-op. At this point, we could easily drop pcmk__xml_init(), replacing it with calls to pcmk__schema_init(). However, pcmk__xml_cleanup() still seems reasonable to have, and it seems intuitive to keep a corresponding init() function. So for now this remains as a wrapper. Signed-off-by: Reid Wahl <[email protected]>
1 parent 64cd854 commit 2f6b74b

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 the Pacemaker project contributors
2+
* Copyright 2023-2025 the Pacemaker project contributors
33
*
44
* The version control history for this file may have further details.
55
*
@@ -13,19 +13,12 @@
1313

1414
#include "crmcommon_private.h"
1515

16-
static void
17-
buffer_scheme_test(void **state)
18-
{
19-
assert_int_equal(XML_BUFFER_ALLOC_DOUBLEIT, xmlGetBufferAllocationScheme());
20-
}
21-
2216
static void
2317
schemas_initialized(void **state)
2418
{
2519
assert_non_null(pcmk__find_x_0_schema());
2620
}
2721

28-
// The group setup/teardown functions call pcmk__xml_init()/pcmk__cml_xleanup()
22+
// The group setup/teardown functions call pcmk__xml_init()/pcmk__xml_cleanup()
2923
PCMK__UNIT_TEST(pcmk__xml_test_setup_group, pcmk__xml_test_teardown_group,
30-
cmocka_unit_test(buffer_scheme_test),
3124
cmocka_unit_test(schemas_initialized))

lib/common/unittest.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 the Pacemaker project contributors
2+
* Copyright 2024-2025 the Pacemaker project contributors
33
*
44
* The version control history for this file may have further details.
55
*
@@ -84,7 +84,7 @@ pcmk__assert_validates(xmlNode *xml)
8484
int
8585
pcmk__xml_test_setup_group(void **state)
8686
{
87-
// Load schemas and set libxml2 buffer allocation scheme
87+
// Load schemas
8888
pcmk__xml_init();
8989
return 0;
9090
}

lib/common/xml.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,8 +1423,7 @@ xml_calculate_changes(xmlNode *old_xml, xmlNode *new_xml)
14231423
* \internal
14241424
* \brief Initialize the Pacemaker XML environment
14251425
*
1426-
* Set an XML buffer allocation scheme, set XML node create and destroy
1427-
* callbacks, and load schemas into the cache.
1426+
* Currently this only loads schemas into the cache. It used to do more.
14281427
*/
14291428
void
14301429
pcmk__xml_init(void)
@@ -1435,12 +1434,6 @@ pcmk__xml_init(void)
14351434
if (!initialized) {
14361435
initialized = true;
14371436

1438-
/* Double the buffer size when the buffer needs to grow. The default
1439-
* allocator XML_BUFFER_ALLOC_EXACT was found to cause poor performance
1440-
* due to the number of reallocs.
1441-
*/
1442-
xmlSetBufferAllocationScheme(XML_BUFFER_ALLOC_DOUBLEIT);
1443-
14441437
// Load schemas into the cache
14451438
pcmk__schema_init();
14461439
}

0 commit comments

Comments
 (0)