Skip to content

Commit c3cd871

Browse files
committed
Use const (ref) variables for loops where possible
1 parent acbdfcf commit c3cd871

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/db-copy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void db_deleter_by_id_t::delete_rows(std::string const &table,
3131
fmt::format_to(std::back_inserter(sql),
3232
FMT_STRING("DELETE FROM {} WHERE {} IN ("), table, column);
3333

34-
for (auto id : m_deletables) {
34+
for (auto const id : m_deletables) {
3535
format_to(std::back_inserter(sql), FMT_STRING("{},"), id);
3636
}
3737
sql[sql.size() - 1] = ')';

src/geom-pole-of-inaccessibility.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ point_t pole_of_inaccessibility(const polygon_t &polygon, double precision,
225225
auto const h = cell.half_size / 2.0;
226226
auto const center = cell.center;
227227

228-
for (auto dy : {-h, h}) {
229-
for (auto dx : {-h, h}) {
228+
for (auto const dy : {-h, h}) {
229+
for (auto const dx : {-h, h}) {
230230
Cell const c{point_t{center.x() + dx, center.y() + dy}, h,
231231
polygon, stretch};
232232
if (c.max > best_cell.dist) {

src/middle-pgsql.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ void middle_pgsql_t::stop()
11681168
if (m_options->droptemp) {
11691169
// Dropping the tables is fast, so do it synchronously to guarantee
11701170
// that the space is freed before creating the other indices.
1171-
for (auto &table : m_tables) {
1171+
for (auto const &table : m_tables) {
11721172
table.drop_table(m_db_connection);
11731173
}
11741174
} else if (!m_options->append) {

src/output-flex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ output_flex_t::output_flex_t(std::shared_ptr<middle_query_t> const &mid,
12581258
m_table_connections.emplace_back(&table, m_copy_thread);
12591259
}
12601260

1261-
for (auto &expire_output : *m_expire_outputs) {
1261+
for (auto const &expire_output : *m_expire_outputs) {
12621262
m_expire_tiles.emplace_back(
12631263
expire_output.maxzoom(),
12641264
reprojection::create_projection(PROJ_SPHERE_MERC));

src/output-pgsql.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ void output_pgsql_t::delete_from_output_and_expire(osmid_t id)
366366
{
367367
m_tables[t_roads]->delete_row(id);
368368

369-
for (auto table : {t_line, t_poly}) {
369+
for (auto const table : {t_line, t_poly}) {
370370
if (m_expire.enabled()) {
371371
auto const results = m_tables.at(table)->get_wkb(id);
372372
if (expire_from_result(&m_expire, results, m_expire_config) != 0) {

0 commit comments

Comments
 (0)