Skip to content

Commit 27e2577

Browse files
committed
Use smaller ints as basis for some enum classes
And reorder class members in one case to make the memory footprint smaller.
1 parent ce415eb commit 27e2577

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/middle-pgsql.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,18 @@ class member_list_json_builder
235235
}
236236

237237
private:
238-
osmium::builder::RelationMemberListBuilder *m_builder;
239238
std::string m_role;
239+
osmium::builder::RelationMemberListBuilder *m_builder;
240240
osmium::object_id_type m_ref = 0;
241241
osmium::item_type m_type = osmium::item_type::undefined;
242-
enum class next_val
242+
enum class next_val : std::uint8_t
243243
{
244244
none,
245245
type,
246246
ref,
247247
role
248248
} m_next_val = next_val::none;
249-
};
249+
}; // class member_list_json_builder
250250

251251
template <typename T>
252252
void pgsql_parse_json_members(char const *string,

src/output-flex.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct options_t;
4040
* When C++ code is called from the Lua code we sometimes need to know
4141
* in what context this happens. These are the possible contexts.
4242
*/
43-
enum class calling_context
43+
enum class calling_context : std::uint8_t
4444
{
4545
main = 0, ///< In main context, i.e. the Lua script outside any callbacks
4646
process_node = 1, ///< In the process_node() callback

src/taginfo.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
* For a full list of authors see the git log.
1111
*/
1212

13+
#include <cstdint>
1314
#include <string>
1415
#include <vector>
1516

16-
enum class ColumnType
17+
enum class ColumnType : std::uint8_t
1718
{
1819
INT,
1920
REAL,

tests/test-output-flex-nodes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ TEST_CASE("add nodes")
5353
CHECK(1 == conn.get_count("osm2pgsql_test_t1", "node_id = 17"));
5454
}
5555

56-
enum class node_relationship
56+
enum class node_relationship : std::uint8_t
5757
{
5858
none,
5959
in_way,

0 commit comments

Comments
 (0)