Skip to content

Commit 75a3f19

Browse files
committed
Use options parameter directly instead of get_options()
Does the same thing, but first is simpler. Also renames parameter name "o" to "options".
1 parent 47abd1d commit 75a3f19

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

src/output-flex.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,12 +1999,13 @@ output_flex_t::clone(std::shared_ptr<middle_query_t> const &mid,
19991999

20002000
output_flex_t::output_flex_t(std::shared_ptr<middle_query_t> const &mid,
20012001
std::shared_ptr<thread_pool_t> thread_pool,
2002-
options_t const &o)
2003-
: output_t(mid, std::move(thread_pool), o),
2004-
m_copy_thread(std::make_shared<db_copy_thread_t>(get_options()->conninfo)),
2005-
m_expire(o.expire_tiles_zoom, o.expire_tiles_max_bbox, o.projection)
2002+
options_t const &options)
2003+
: output_t(mid, std::move(thread_pool), options),
2004+
m_copy_thread(std::make_shared<db_copy_thread_t>(options.conninfo)),
2005+
m_expire(options.expire_tiles_zoom, options.expire_tiles_max_bbox,
2006+
options.projection)
20062007
{
2007-
init_lua(get_options()->style);
2008+
init_lua(options.style);
20082009

20092010
// If the osm2pgsql.select_relation_members() Lua function is defined
20102011
// it means we need two-stage processing which in turn means we need

src/output-gazetteer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class output_gazetteer_t : public output_t
3434
std::shared_ptr<thread_pool_t> thread_pool,
3535
options_t const &options)
3636
: output_t(mid, std::move(thread_pool), options),
37-
m_copy(std::make_shared<db_copy_thread_t>(get_options()->conninfo)),
37+
m_copy(std::make_shared<db_copy_thread_t>(options.conninfo)),
3838
m_proj(options.projection)
3939
{
4040
m_style.load_style(options.style);

src/output-pgsql.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -420,23 +420,23 @@ std::shared_ptr<output_t> output_pgsql_t::clone(
420420

421421
output_pgsql_t::output_pgsql_t(std::shared_ptr<middle_query_t> const &mid,
422422
std::shared_ptr<thread_pool_t> thread_pool,
423-
options_t const &o)
424-
: output_t(mid, std::move(thread_pool), o), m_proj(o.projection),
425-
m_expire(o.expire_tiles_zoom, o.expire_tiles_max_bbox, o.projection),
423+
options_t const &options)
424+
: output_t(mid, std::move(thread_pool), options), m_proj(options.projection),
425+
m_expire(options.expire_tiles_zoom, options.expire_tiles_max_bbox,
426+
options.projection),
426427
m_buffer(32768, osmium::memory::Buffer::auto_grow::yes),
427428
m_rels_buffer(1024, osmium::memory::Buffer::auto_grow::yes)
428429
{
429-
log_debug("Using projection SRS {} ({})", o.projection->target_srs(),
430-
o.projection->target_desc());
430+
log_debug("Using projection SRS {} ({})", options.projection->target_srs(),
431+
options.projection->target_desc());
431432

432433
export_list exlist;
433434

434-
m_enable_way_area = read_style_file(get_options()->style, &exlist);
435+
m_enable_way_area = read_style_file(options.style, &exlist);
435436

436-
m_tagtransform = tagtransform_t::make_tagtransform(get_options(), exlist);
437+
m_tagtransform = tagtransform_t::make_tagtransform(&options, exlist);
437438

438-
auto copy_thread =
439-
std::make_shared<db_copy_thread_t>(get_options()->conninfo);
439+
auto copy_thread = std::make_shared<db_copy_thread_t>(options.conninfo);
440440

441441
//for each table
442442
for (size_t i = 0; i < t_MAX; ++i) {
@@ -446,7 +446,7 @@ output_pgsql_t::output_pgsql_t(std::shared_ptr<middle_query_t> const &mid,
446446
(i == t_point) ? osmium::item_type::node : osmium::item_type::way);
447447

448448
//figure out what name we are using for this and what type
449-
std::string name = get_options()->prefix;
449+
std::string name = options.prefix;
450450
std::string type;
451451
switch (i) {
452452
case t_point:
@@ -471,10 +471,9 @@ output_pgsql_t::output_pgsql_t(std::shared_ptr<middle_query_t> const &mid,
471471
}
472472

473473
m_tables[i] = std::make_unique<table_t>(
474-
name, type, columns, get_options()->hstore_columns,
475-
get_options()->projection->target_srs(), get_options()->append,
476-
get_options()->hstore_mode, copy_thread,
477-
get_options()->output_dbschema);
474+
name, type, columns, options.hstore_columns,
475+
options.projection->target_srs(), options.append,
476+
options.hstore_mode, copy_thread, options.output_dbschema);
478477
}
479478
}
480479

0 commit comments

Comments
 (0)