diff --git a/test/cleanup.hpp b/test/cleanup.hpp index 264a6b559..b30ab215a 100644 --- a/test/cleanup.hpp +++ b/test/cleanup.hpp @@ -1,9 +1,11 @@ #ifndef TEST_MEMORY_CLEANUP #define TEST_MEMORY_CLEANUP +#if defined(HAS_XML2) #include #include #include +#endif #if defined(HAVE_CAIRO) #include @@ -21,6 +23,7 @@ inline void run_cleanup() // only call this once, on exit // to make sure valgrind output is clean // http://xmlsoft.org/xmlmem.html +#if defined(HAS_XML2) xmlCleanupCharEncodingHandlers(); xmlCleanupEncodingAliases(); xmlCleanupGlobals(); @@ -29,6 +32,7 @@ inline void run_cleanup() xmlCleanupInputCallbacks(); xmlCleanupOutputCallbacks(); xmlCleanupMemory(); +#endif #if defined(HAVE_CAIRO) // http://cairographics.org/manual/cairo-Error-handling.html#cairo-debug-reset-static-data @@ -45,9 +49,9 @@ inline void run_cleanup() #endif // https://trac.osgeo.org/proj/wiki/ProjAPI#EnvironmentFunctions pj_deallocate_grids(); -#endif +#endif } } -#endif \ No newline at end of file +#endif diff --git a/test/unit/svg/svg_parser_test.cpp b/test/unit/svg/svg_parser_test.cpp index ec7566a1f..d7e1b9ca4 100644 --- a/test/unit/svg/svg_parser_test.cpp +++ b/test/unit/svg/svg_parser_test.cpp @@ -27,18 +27,12 @@ #include #include #include - -//#include -//#include -//#include - #include #include #include #include #include -#include // for xmlInitParser(), xmlCleanupParser() #include #include #include @@ -61,7 +55,6 @@ struct vertex_equal TEST_CASE("SVG parser") { - xmlInitParser(); SECTION("SVG i/o") { std::string svg_name("FAIL"); @@ -688,7 +681,4 @@ TEST_CASE("SVG parser") { transform *= agg::trans_affine_translation(240,155); REQUIRE(attrs[1].fill_gradient.get_transform() == transform); } - - - xmlCleanupParser(); } diff --git a/utils/svg2png/svg2png.cpp b/utils/svg2png/svg2png.cpp index 87b8f0e8c..3e00663bb 100644 --- a/utils/svg2png/svg2png.cpp +++ b/utils/svg2png/svg2png.cpp @@ -48,8 +48,6 @@ #include "agg_pixfmt_rgba.h" #include "agg_scanline_u.h" -#include // for xmlInitParser(), xmlCleanupParser() - struct main_marker_visitor { main_marker_visitor(std::string const& svg_name, @@ -198,8 +196,6 @@ int main (int argc,char** argv) return 0; } - xmlInitParser(); - while (itr != svg_files.end()) { std::string svg_name (*itr++); @@ -216,19 +212,12 @@ int main (int argc,char** argv) catch (std::exception const& ex) { std::clog << "Exception caught:" << ex.what() << std::endl; - xmlCleanupParser(); return -1; } catch (...) { std::clog << "Exception of unknown type!" << std::endl; - xmlCleanupParser(); return -1; } - - // only call this once, on exit - // to make sure valgrind output is clean - // http://xmlsoft.org/xmlmem.html - xmlCleanupParser(); return status; }