Skip to content

Commit 4ebd470

Browse files
committed
Remove unnecessary intermediate *_modify functions
1 parent 161559e commit 4ebd470

File tree

2 files changed

+24
-39
lines changed

2 files changed

+24
-39
lines changed

src/osmdata.cpp

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,15 @@ void osmdata_t::node(osmium::Node const &node)
6161
return;
6262
}
6363

64+
bool const has_tags_or_attrs = m_with_extra_attrs || !node.tags().empty();
6465
if (m_append) {
65-
node_modify(node);
66-
} else if (m_with_extra_attrs || !node.tags().empty()) {
66+
if (has_tags_or_attrs) {
67+
m_output->node_modify(node);
68+
} else {
69+
m_output->node_delete(node.id());
70+
}
71+
m_dependency_manager->node_changed(node.id());
72+
} else if (has_tags_or_attrs) {
6773
m_output->node_add(node);
6874
}
6975
}
@@ -83,9 +89,15 @@ void osmdata_t::way(osmium::Way &way)
8389
return;
8490
}
8591

92+
bool const has_tags_or_attrs = m_with_extra_attrs || !way.tags().empty();
8693
if (m_append) {
87-
way_modify(&way);
88-
} else if (m_with_extra_attrs || !way.tags().empty()) {
94+
if (has_tags_or_attrs) {
95+
m_output->way_modify(&way);
96+
} else {
97+
m_output->way_delete(way.id());
98+
}
99+
m_dependency_manager->way_changed(way.id());
100+
} else if (has_tags_or_attrs) {
89101
m_output->way_add(&way);
90102
}
91103
}
@@ -115,44 +127,21 @@ void osmdata_t::relation(osmium::Relation const &rel)
115127
m_output->relation_delete(rel.id());
116128
return;
117129
}
130+
131+
bool const has_tags_or_attrs = m_with_extra_attrs || !rel.tags().empty();
118132
if (m_append) {
119-
relation_modify(rel);
120-
} else if (m_with_extra_attrs || !rel.tags().empty()) {
133+
if (has_tags_or_attrs) {
134+
m_output->relation_modify(rel);
135+
} else {
136+
m_output->relation_delete(rel.id());
137+
}
138+
} else if (has_tags_or_attrs) {
121139
m_output->relation_add(rel);
122140
}
123141
}
124142

125143
void osmdata_t::after_relations() { m_mid->after_relations(); }
126144

127-
void osmdata_t::node_modify(osmium::Node const &node) const
128-
{
129-
if (m_with_extra_attrs || !node.tags().empty()) {
130-
m_output->node_modify(node);
131-
} else {
132-
m_output->node_delete(node.id());
133-
}
134-
m_dependency_manager->node_changed(node.id());
135-
}
136-
137-
void osmdata_t::way_modify(osmium::Way *way) const
138-
{
139-
if (m_with_extra_attrs || !way->tags().empty()) {
140-
m_output->way_modify(way);
141-
} else {
142-
m_output->way_delete(way->id());
143-
}
144-
m_dependency_manager->way_changed(way->id());
145-
}
146-
147-
void osmdata_t::relation_modify(osmium::Relation const &rel) const
148-
{
149-
if (m_with_extra_attrs || !rel.tags().empty()) {
150-
m_output->relation_modify(rel);
151-
} else {
152-
m_output->relation_delete(rel.id());
153-
}
154-
}
155-
156145
void osmdata_t::start() const
157146
{
158147
m_output->start();

src/osmdata.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ class osmdata_t : public osmium::handler::Handler
6161
void stop() const;
6262

6363
private:
64-
void node_modify(osmium::Node const &node) const;
65-
void way_modify(osmium::Way *way) const;
66-
void relation_modify(osmium::Relation const &rel) const;
67-
6864
/**
6965
* Run stage 1b and stage 1c processing: Process dependent objects in
7066
* append mode.

0 commit comments

Comments
 (0)