remove libxml includes and init calls

This commit is contained in:
artemp 2015-07-30 13:13:53 +02:00
parent 9d43f69cf6
commit f8fd60dc69
3 changed files with 6 additions and 23 deletions

View File

@ -1,9 +1,11 @@
#ifndef TEST_MEMORY_CLEANUP
#define TEST_MEMORY_CLEANUP
#if defined(HAS_XML2)
#include <libxml/parser.h>
#include <libxml/entities.h>
#include <libxml/globals.h>
#endif
#if defined(HAVE_CAIRO)
#include <cairo.h>
@ -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
#endif

View File

@ -27,18 +27,12 @@
#include <mapnik/marker.hpp>
#include <mapnik/marker_cache.hpp>
#include <mapnik/vertex.hpp>
//#include <mapnik/svg/svg_path_adapter.hpp>
//#include <mapnik/svg/svg_renderer_agg.hpp>
//#include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/svg/svg_parser.hpp>
#include <mapnik/svg/svg_storage.hpp>
#include <mapnik/svg/svg_converter.hpp>
#include <mapnik/svg/svg_path_adapter.hpp>
#include <mapnik/svg/svg_path_attributes.hpp>
#include <libxml/parser.h> // for xmlInitParser(), xmlCleanupParser()
#include <cmath>
#include <fstream>
#include <streambuf>
@ -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();
}

View File

@ -48,8 +48,6 @@
#include "agg_pixfmt_rgba.h"
#include "agg_scanline_u.h"
#include <libxml/parser.h> // 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;
}