@@ -50,10 +50,12 @@ int geom_gc(lua_State *lua_state) noexcept
5050 return 0 ;
5151}
5252
53+ namespace {
54+
5355// The following functions are called when their counterparts in Lua are
5456// called on geometry objects.
5557
56- static int geom_area (lua_State *lua_state)
58+ int geom_area (lua_State *lua_state)
5759{
5860 auto const *const input_geometry = unpack_geometry (lua_state);
5961
@@ -66,7 +68,7 @@ static int geom_area(lua_State *lua_state)
6668 return 1 ;
6769}
6870
69- static int geom_spherical_area (lua_State *lua_state)
71+ int geom_spherical_area (lua_State *lua_state)
7072{
7173 auto const *const input_geometry = unpack_geometry (lua_state);
7274
@@ -84,7 +86,7 @@ static int geom_spherical_area(lua_State *lua_state)
8486 return 1 ;
8587}
8688
87- static int geom_length (lua_State *lua_state)
89+ int geom_length (lua_State *lua_state)
8890{
8991 auto const *const input_geometry = unpack_geometry (lua_state);
9092 try {
@@ -96,7 +98,7 @@ static int geom_length(lua_State *lua_state)
9698 return 1 ;
9799}
98100
99- static int geom_centroid (lua_State *lua_state)
101+ int geom_centroid (lua_State *lua_state)
100102{
101103 auto const *const input_geometry = unpack_geometry (lua_state);
102104
@@ -110,7 +112,7 @@ static int geom_centroid(lua_State *lua_state)
110112 return 1 ;
111113}
112114
113- static int geom_geometry_n (lua_State *lua_state)
115+ int geom_geometry_n (lua_State *lua_state)
114116{
115117 auto const *const input_geometry = unpack_geometry (lua_state);
116118 auto const index = static_cast <int >(luaL_checkinteger (lua_state, 2 ));
@@ -125,7 +127,7 @@ static int geom_geometry_n(lua_State *lua_state)
125127 return 1 ;
126128}
127129
128- static int geom_geometry_type (lua_State *lua_state)
130+ int geom_geometry_type (lua_State *lua_state)
129131{
130132 auto const *const input_geometry = unpack_geometry (lua_state);
131133
@@ -139,14 +141,14 @@ static int geom_geometry_type(lua_State *lua_state)
139141 return 1 ;
140142}
141143
142- static int geom_is_null (lua_State *lua_state)
144+ int geom_is_null (lua_State *lua_state)
143145{
144146 auto const *const input_geometry = unpack_geometry (lua_state);
145147 lua_pushboolean (lua_state, input_geometry->is_null ());
146148 return 1 ;
147149}
148150
149- static int geom_reverse (lua_State *lua_state)
151+ int geom_reverse (lua_State *lua_state)
150152{
151153 auto const *const input_geometry = unpack_geometry (lua_state);
152154
@@ -160,7 +162,7 @@ static int geom_reverse(lua_State *lua_state)
160162 return 1 ;
161163}
162164
163- static int geom_line_merge (lua_State *lua_state)
165+ int geom_line_merge (lua_State *lua_state)
164166{
165167 auto const *const input_geometry = unpack_geometry (lua_state);
166168
@@ -174,15 +176,15 @@ static int geom_line_merge(lua_State *lua_state)
174176 return 1 ;
175177}
176178
177- static int geom_num_geometries (lua_State *lua_state)
179+ int geom_num_geometries (lua_State *lua_state)
178180{
179181 auto const *const input_geometry = unpack_geometry (lua_state);
180182 lua_pushinteger (lua_state,
181183 static_cast <lua_Integer>(num_geometries (*input_geometry)));
182184 return 1 ;
183185}
184186
185- static int geom_pole_of_inaccessibility (lua_State *lua_state)
187+ int geom_pole_of_inaccessibility (lua_State *lua_state)
186188{
187189 auto const *const input_geometry = unpack_geometry (lua_state);
188190
@@ -210,7 +212,7 @@ static int geom_pole_of_inaccessibility(lua_State *lua_state)
210212 return 1 ;
211213}
212214
213- static int geom_segmentize (lua_State *lua_state)
215+ int geom_segmentize (lua_State *lua_state)
214216{
215217 auto const *const input_geometry = unpack_geometry (lua_state);
216218 double const max_segment_length = luaL_checknumber (lua_state, 2 );
@@ -225,7 +227,7 @@ static int geom_segmentize(lua_State *lua_state)
225227 return 1 ;
226228}
227229
228- static int geom_simplify (lua_State *lua_state)
230+ int geom_simplify (lua_State *lua_state)
229231{
230232 auto const *const input_geometry = unpack_geometry (lua_state);
231233 double const tolerance = luaL_checknumber (lua_state, 2 );
@@ -240,7 +242,7 @@ static int geom_simplify(lua_State *lua_state)
240242 return 1 ;
241243}
242244
243- static int geom_srid (lua_State *lua_state)
245+ int geom_srid (lua_State *lua_state)
244246{
245247 auto const *const input_geometry = unpack_geometry (lua_state);
246248 lua_pushinteger (lua_state,
@@ -251,12 +253,12 @@ static int geom_srid(lua_State *lua_state)
251253// XXX Implementation for Lua __tostring function on geometries. Currently
252254// just returns the type as string. This could be improved, for instance by
253255// showing a WKT representation of the geometry.
254- static int geom_tostring (lua_State *lua_state)
256+ int geom_tostring (lua_State *lua_state)
255257{
256258 return geom_geometry_type (lua_state);
257259}
258260
259- static int geom_transform (lua_State *lua_state)
261+ int geom_transform (lua_State *lua_state)
260262{
261263 auto const *const input_geometry = unpack_geometry (lua_state);
262264 auto const srid = static_cast <int >(luaL_checkinteger (lua_state, 2 ));
@@ -275,6 +277,8 @@ static int geom_transform(lua_State *lua_state)
275277 return 1 ;
276278}
277279
280+ } // anonymous namespace
281+
278282void init_geometry_class (lua_State *lua_state)
279283{
280284 lua_getglobal (lua_state, " osm2pgsql" );
0 commit comments