Skip to content

Commit 161559e

Browse files
committed
Remove unnecessary intermediate *_add functions
1 parent b5b3283 commit 161559e

File tree

2 files changed

+20
-43
lines changed

2 files changed

+20
-43
lines changed

src/osmdata.cpp

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ void osmdata_t::node(osmium::Node const &node)
5858

5959
if (node.deleted()) {
6060
m_output->node_delete(node.id());
61-
} else {
62-
if (m_append) {
63-
node_modify(node);
64-
} else {
65-
node_add(node);
66-
}
61+
return;
62+
}
63+
64+
if (m_append) {
65+
node_modify(node);
66+
} else if (m_with_extra_attrs || !node.tags().empty()) {
67+
m_output->node_add(node);
6768
}
6869
}
6970

@@ -79,12 +80,13 @@ void osmdata_t::way(osmium::Way &way)
7980

8081
if (way.deleted()) {
8182
m_output->way_delete(way.id());
82-
} else {
83-
if (m_append) {
84-
way_modify(&way);
85-
} else {
86-
way_add(&way);
87-
}
83+
return;
84+
}
85+
86+
if (m_append) {
87+
way_modify(&way);
88+
} else if (m_with_extra_attrs || !way.tags().empty()) {
89+
m_output->way_add(&way);
8890
}
8991
}
9092

@@ -111,38 +113,17 @@ void osmdata_t::relation(osmium::Relation const &rel)
111113

112114
if (rel.deleted()) {
113115
m_output->relation_delete(rel.id());
114-
} else {
115-
if (m_append) {
116-
relation_modify(rel);
117-
} else {
118-
relation_add(rel);
119-
}
120-
}
121-
}
122-
123-
void osmdata_t::after_relations() { m_mid->after_relations(); }
124-
125-
void osmdata_t::node_add(osmium::Node const &node) const
126-
{
127-
if (m_with_extra_attrs || !node.tags().empty()) {
128-
m_output->node_add(node);
129-
}
130-
}
131-
132-
void osmdata_t::way_add(osmium::Way *way) const
133-
{
134-
if (m_with_extra_attrs || !way->tags().empty()) {
135-
m_output->way_add(way);
116+
return;
136117
}
137-
}
138-
139-
void osmdata_t::relation_add(osmium::Relation const &rel) const
140-
{
141-
if (m_with_extra_attrs || !rel.tags().empty()) {
118+
if (m_append) {
119+
relation_modify(rel);
120+
} else if (m_with_extra_attrs || !rel.tags().empty()) {
142121
m_output->relation_add(rel);
143122
}
144123
}
145124

125+
void osmdata_t::after_relations() { m_mid->after_relations(); }
126+
146127
void osmdata_t::node_modify(osmium::Node const &node) const
147128
{
148129
if (m_with_extra_attrs || !node.tags().empty()) {

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_add(osmium::Node const &node) const;
65-
void way_add(osmium::Way *way) const;
66-
void relation_add(osmium::Relation const &rel) const;
67-
6864
void node_modify(osmium::Node const &node) const;
6965
void way_modify(osmium::Way *way) const;
7066
void relation_modify(osmium::Relation const &rel) const;

0 commit comments

Comments
 (0)