tests: remove uses of `xmlKeepBlanksDefault()`
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 30 Apr 2024 19:19:32 +0000 (15:19 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 1 May 2024 14:59:58 +0000 (10:59 -0400)
commit051356a81761338485706e779d046d7fb8dbfe1d
tree48112d278803bc6861efe5926fd5f3117289a8ca
parent9617033a3a3229daabe17e38fbab802ec2e6e223
tests: remove uses of `xmlKeepBlanksDefault()`

When compiling against libxml 2.12.6, I get:

      CXX      extract_xml-extract_xml.o
    /home/simark/src/lttng-tools/tests/utils/xml-utils/extract_xml.cpp: In function ‘int main(int, char**)’:
    /home/simark/src/lttng-tools/tests/utils/xml-utils/extract_xml.cpp:256:29: error: ‘int xmlKeepBlanksDefault(int)’ is deprecated [-Werror=deprecated-declarations]
      256 |         xmlKeepBlanksDefault(0);
          |         ~~~~~~~~~~~~~~~~~~~~^~~
    In file included from /home/simark/src/lttng-tools/tests/utils/xml-utils/extract_xml.cpp:29:
    /usr/include/libxml2/libxml/parser.h:957:17: note: declared here
      957 |                 xmlKeepBlanksDefault    (int val);
          |                 ^~~~~~~~~~~~~~~~~~~~

The documentation[1] suggests moving to "the modern options API with
XML_PARSE_NOBLANKS", do that.

Add a new `xml_parser_ctx_uptr` RAII object to manage the lifetime of
the `xmlParserCtxt` object.

[1] https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#xmlKeepBlanksDefault

Change-Id: I7f9e70d2245fa333e01296aa2b4e3efa4e7fbefa
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/utils/xml-utils/Makefile.am
tests/utils/xml-utils/common.hpp [new file with mode: 0644]
tests/utils/xml-utils/extract_xml.cpp
tests/utils/xml-utils/pretty_xml.cpp
This page took 0.041246 seconds and 4 git commands to generate.