diff --git a/src/output-flex.cpp b/src/output-flex.cpp index eb14678c7..8fe7bc3bc 100644 --- a/src/output-flex.cpp +++ b/src/output-flex.cpp @@ -1997,14 +1997,15 @@ output_flex_t::clone(std::shared_ptr const &mid, return std::make_shared(this, mid, copy_thread); } -output_flex_t::output_flex_t( - std::shared_ptr const &mid, - std::shared_ptr thread_pool, options_t const &o, - std::shared_ptr const ©_thread) -: output_t(mid, std::move(thread_pool), o), m_copy_thread(copy_thread), - m_expire(o.expire_tiles_zoom, o.expire_tiles_max_bbox, o.projection) -{ - init_lua(get_options()->style); +output_flex_t::output_flex_t(std::shared_ptr const &mid, + std::shared_ptr thread_pool, + options_t const &options) +: output_t(mid, std::move(thread_pool), options), + m_copy_thread(std::make_shared(options.conninfo)), + m_expire(options.expire_tiles_zoom, options.expire_tiles_max_bbox, + options.projection) +{ + init_lua(options.style); // If the osm2pgsql.select_relation_members() Lua function is defined // it means we need two-stage processing which in turn means we need diff --git a/src/output-flex.hpp b/src/output-flex.hpp index 83819f0c4..88dd8bf7f 100644 --- a/src/output-flex.hpp +++ b/src/output-flex.hpp @@ -99,10 +99,9 @@ class output_flex_t : public output_t { public: /// Constructor for new objects - output_flex_t( - std::shared_ptr const &mid, - std::shared_ptr thread_pool, options_t const &options, - std::shared_ptr const ©_thread); + output_flex_t(std::shared_ptr const &mid, + std::shared_ptr thread_pool, + options_t const &options); /// Constructor for cloned objects output_flex_t(output_flex_t const *other, diff --git a/src/output-gazetteer.hpp b/src/output-gazetteer.hpp index 173115432..725db4506 100644 --- a/src/output-gazetteer.hpp +++ b/src/output-gazetteer.hpp @@ -32,9 +32,9 @@ class output_gazetteer_t : public output_t /// Constructor for new objects output_gazetteer_t(std::shared_ptr const &mid, std::shared_ptr thread_pool, - options_t const &options, - std::shared_ptr const ©_thread) - : output_t(mid, std::move(thread_pool), options), m_copy(copy_thread), + options_t const &options) + : output_t(mid, std::move(thread_pool), options), + m_copy(std::make_shared(options.conninfo)), m_proj(options.projection) { m_style.load_style(options.style); diff --git a/src/output-pgsql.cpp b/src/output-pgsql.cpp index bd3c8b20a..7f2b7c0a6 100644 --- a/src/output-pgsql.cpp +++ b/src/output-pgsql.cpp @@ -418,23 +418,25 @@ std::shared_ptr output_pgsql_t::clone( return std::make_shared(this, mid, copy_thread); } -output_pgsql_t::output_pgsql_t( - std::shared_ptr const &mid, - std::shared_ptr thread_pool, options_t const &o, - std::shared_ptr const ©_thread) -: output_t(mid, std::move(thread_pool), o), m_proj(o.projection), - m_expire(o.expire_tiles_zoom, o.expire_tiles_max_bbox, o.projection), +output_pgsql_t::output_pgsql_t(std::shared_ptr const &mid, + std::shared_ptr thread_pool, + options_t const &options) +: output_t(mid, std::move(thread_pool), options), m_proj(options.projection), + m_expire(options.expire_tiles_zoom, options.expire_tiles_max_bbox, + options.projection), m_buffer(32768, osmium::memory::Buffer::auto_grow::yes), m_rels_buffer(1024, osmium::memory::Buffer::auto_grow::yes) { - log_debug("Using projection SRS {} ({})", o.projection->target_srs(), - o.projection->target_desc()); + log_debug("Using projection SRS {} ({})", options.projection->target_srs(), + options.projection->target_desc()); export_list exlist; - m_enable_way_area = read_style_file(get_options()->style, &exlist); + m_enable_way_area = read_style_file(options.style, &exlist); + + m_tagtransform = tagtransform_t::make_tagtransform(&options, exlist); - m_tagtransform = tagtransform_t::make_tagtransform(get_options(), exlist); + auto copy_thread = std::make_shared(options.conninfo); //for each table for (size_t i = 0; i < t_MAX; ++i) { @@ -444,7 +446,7 @@ output_pgsql_t::output_pgsql_t( (i == t_point) ? osmium::item_type::node : osmium::item_type::way); //figure out what name we are using for this and what type - std::string name = get_options()->prefix; + std::string name = options.prefix; std::string type; switch (i) { case t_point: @@ -469,10 +471,9 @@ output_pgsql_t::output_pgsql_t( } m_tables[i] = std::make_unique( - name, type, columns, get_options()->hstore_columns, - get_options()->projection->target_srs(), get_options()->append, - get_options()->hstore_mode, copy_thread, - get_options()->output_dbschema); + name, type, columns, options.hstore_columns, + options.projection->target_srs(), options.append, + options.hstore_mode, copy_thread, options.output_dbschema); } } diff --git a/src/output-pgsql.hpp b/src/output-pgsql.hpp index 54589ee18..70161d91c 100644 --- a/src/output-pgsql.hpp +++ b/src/output-pgsql.hpp @@ -40,8 +40,7 @@ class output_pgsql_t : public output_t /// Constructor for new objects output_pgsql_t(std::shared_ptr const &mid, std::shared_ptr thread_pool, - options_t const &options, - std::shared_ptr const ©_thread); + options_t const &options); /// Constructor for cloned objects output_pgsql_t(output_pgsql_t const *other, diff --git a/src/output.cpp b/src/output.cpp index adbb024c2..6ade875e7 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -30,23 +30,21 @@ output_t::create_output(std::shared_ptr const &mid, std::shared_ptr thread_pool, options_t const &options) { - auto copy_thread = std::make_shared(options.conninfo); - if (options.output_backend == "pgsql") { return std::make_shared(mid, std::move(thread_pool), - options, copy_thread); + options); } #ifdef HAVE_LUA if (options.output_backend == "flex") { return std::make_shared(mid, std::move(thread_pool), - options, copy_thread); + options); } #endif if (options.output_backend == "gazetteer") { return std::make_shared(mid, std::move(thread_pool), - options, copy_thread); + options); } if (options.output_backend == "null") {