PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwgeom_free()

void lwgeom_free ( LWGEOM geom)

Definition at line 1144 of file lwgeom.c.

1145 {
1146 
1147  /* There's nothing here to free... */
1148  if( ! lwgeom ) return;
1149 
1150  LWDEBUGF(5,"freeing a %s",lwtype_name(lwgeom->type));
1151 
1152  switch (lwgeom->type)
1153  {
1154  case POINTTYPE:
1155  lwpoint_free((LWPOINT *)lwgeom);
1156  break;
1157  case LINETYPE:
1158  lwline_free((LWLINE *)lwgeom);
1159  break;
1160  case POLYGONTYPE:
1161  lwpoly_free((LWPOLY *)lwgeom);
1162  break;
1163  case CIRCSTRINGTYPE:
1164  lwcircstring_free((LWCIRCSTRING *)lwgeom);
1165  break;
1166  case TRIANGLETYPE:
1167  lwtriangle_free((LWTRIANGLE *)lwgeom);
1168  break;
1169  case MULTIPOINTTYPE:
1170  lwmpoint_free((LWMPOINT *)lwgeom);
1171  break;
1172  case MULTILINETYPE:
1173  lwmline_free((LWMLINE *)lwgeom);
1174  break;
1175  case MULTIPOLYGONTYPE:
1176  lwmpoly_free((LWMPOLY *)lwgeom);
1177  break;
1178  case POLYHEDRALSURFACETYPE:
1179  lwpsurface_free((LWPSURFACE *)lwgeom);
1180  break;
1181  case TINTYPE:
1182  lwtin_free((LWTIN *)lwgeom);
1183  break;
1184  case CURVEPOLYTYPE:
1185  case COMPOUNDTYPE:
1186  case MULTICURVETYPE:
1187  case MULTISURFACETYPE:
1188  case COLLECTIONTYPE:
1189  lwcollection_free((LWCOLLECTION *)lwgeom);
1190  break;
1191  default:
1192  lwerror("lwgeom_free called with unknown type (%d) %s", lwgeom->type, lwtype_name(lwgeom->type));
1193  }
1194  return;
1195 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
void lwmpoint_free(LWMPOINT *mpt)
Definition: lwmpoint.c:72
void lwpoint_free(LWPOINT *pt)
Definition: lwpoint.c:213
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
void lwmpoly_free(LWMPOLY *mpoly)
Definition: lwmpoly.c:53
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
#define LINETYPE
Definition: liblwgeom.h:86
void lwtin_free(LWTIN *tin)
Definition: lwtin.c:39
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define TINTYPE
Definition: liblwgeom.h:99
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POLYGONTYPE
Definition: liblwgeom.h:87
void lwcircstring_free(LWCIRCSTRING *curve)
Definition: lwcircstring.c:97
void lwtriangle_free(LWTRIANGLE *triangle)
Definition: lwtriangle.c:69
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:356
#define MULTICURVETYPE
Definition: liblwgeom.h:95
#define TRIANGLETYPE
Definition: liblwgeom.h:98
void lwpsurface_free(LWPSURFACE *psurf)
Definition: lwpsurface.c:39
void lwpoly_free(LWPOLY *poly)
Definition: lwpoly.c:175
void lwmline_free(LWMLINE *mline)
Definition: lwmline.c:112
void lwline_free(LWLINE *line)
Definition: lwline.c:76
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LINETYPE, lwcircstring_free(), lwcollection_free(), LWDEBUGF, lwerror(), lwline_free(), lwmline_free(), lwmpoint_free(), lwmpoly_free(), lwpoint_free(), lwpoly_free(), lwpsurface_free(), lwtin_free(), lwtriangle_free(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, LWGEOM::type, and LWPOINT::type.

Referenced by _lwt_AddEdge(), _lwt_AddLine(), _lwt_AddLineEdge(), _lwt_AddPoint(), _lwt_EdgeSplit(), _lwt_FindAdjacentEdges(), _lwt_split_by_nodes(), _lwt_toposnap(), basic_test(), boundary(), BOX3D_combine(), buildarea1(), buildarea2(), buildarea3(), buildarea4(), buildarea4b(), buildarea5(), buildarea6(), buildarea7(), centroid(), check_dimension(), CircTreePIP(), cluster_within_distance_garray(), contains(), convexhull(), coveredby(), covers(), cu_twkb(), cu_twkb_idlist(), cu_twkb_in(), cu_wkb(), cu_wkb_empty_point_check(), cu_wkb_from_hexwkb(), cu_wkb_in(), cu_wkt(), do_dbscan_test(), do_encoded_polyline_test(), do_fn_test(), do_geojson_test(), do_geojson_unsupported(), do_geom_test(), do_gml2_extent_test(), do_gml2_test(), do_gml2_test_prefix(), do_gml2_unsupported(), do_gml3_extent_test(), do_gml3_test(), do_gml3_test_nodims(), do_gml3_test_opts(), do_gml3_test_prefix(), do_grid_test(), do_kml_test(), do_kml_test_prefix(), do_kml_unsupported(), do_lwgeom_swap_ordinates(), do_median_dims_check(), do_median_test(), do_svg_test(), do_svg_unsupported(), do_test_chaikin(), do_test_filterm(), do_test_mindistance_tolerance(), do_type_test(), do_x3d3_test(), do_x3d3_unsupported(), errorIfGeometryCollection(), GenerateLineStringGeometry(), GeneratePointGeometry(), GeneratePolygonGeometry(), geography_area(), geography_as_geojson(), geography_as_gml(), geography_as_kml(), geography_as_svg(), geography_azimuth(), geography_centroid_from_mline(), geography_centroid_from_mpoly(), geography_covers(), geography_distance_cache_tolerance(), geography_distance_knn(), geography_distance_uncached(), geography_dwithin(), geography_dwithin_uncached(), geography_from_binary(), geography_from_geometry(), geography_from_text(), geography_in(), geography_length(), geography_out(), geography_perimeter(), geography_project(), geography_recv(), geography_segmentize(), geography_send(), geography_tree_distance(), geom_from_geojson(), geom_from_gml(), geom_from_kml(), geometry_from_geography(), geometry_to_path(), geometry_to_polygon(), GEOS2POSTGIS(), geos_difference(), geos_geomunion(), geos_intersection(), geos_intersects(), gserialized_distance_nd(), gserialized_get_gbox_p(), issimple(), isvalid(), line_from_encoded_polyline(), linemerge(), lw_dist2d_circstring_poly(), lw_dist2d_poly_curvepoly(), lwcollection_free(), lwcollection_from_wkb_state(), lwcollection_offsetcurve(), lwcollection_segmentize2d(), lwcollection_wrapx(), lwcurvepoly_from_wkb_state(), LWGEOM2GEOS(), LWGEOM_affine(), LWGEOM_area_polygon(), LWGEOM_asBinary(), LWGEOM_asEncodedPolyline(), LWGEOM_asEWKT(), LWGEOM_asGeoJson(), LWGEOM_asGML(), LWGEOM_asHEXEWKB(), LWGEOM_asKML(), LWGEOM_asSVG(), LWGEOM_asText(), LWGEOM_asX3D(), LWGEOM_ChaikinSmoothing(), LWGEOM_closestpoint(), LWGEOM_closestpoint3d(), lwgeom_cluster_2d_kmeans(), LWGEOM_collect(), LWGEOM_curve_segmentize(), LWGEOM_dimension(), LWGEOM_endpoint_linestring(), LWGEOM_expand(), LWGEOM_exteriorring_polygon(), LWGEOM_FilterByM(), LWGEOM_force_2d(), LWGEOM_force_3dm(), LWGEOM_force_3dz(), LWGEOM_force_4d(), LWGEOM_force_clockwise_poly(), LWGEOM_force_collection(), lwgeom_force_sfs(), lwgeom_from_geojson(), lwgeom_from_gml(), LWGEOM_from_WKB(), lwgeom_grid_in_place(), LWGEOM_has_arc(), LWGEOM_in(), LWGEOM_interiorringn_polygon(), LWGEOM_isclosed(), LWGEOM_isempty(), LWGEOM_length2d_ellipsoid(), LWGEOM_length2d_linestring(), LWGEOM_length_ellipsoid_linestring(), LWGEOM_length_linestring(), LWGEOM_line_desegmentize(), LWGEOM_line_interpolate_point(), LWGEOM_line_substring(), LWGEOM_locate_between_m(), LWGEOM_longestline2d(), LWGEOM_longestline3d(), LWGEOM_longitude_shift(), LWGEOM_makeline(), LWGEOM_mindistance2d(), lwgeom_node(), LWGEOM_noop(), LWGEOM_npoints(), LWGEOM_nrings(), LWGEOM_numgeometries_collection(), LWGEOM_numinteriorrings_polygon(), LWGEOM_numpoints_linestring(), lwgeom_offsetcurve(), LWGEOM_out(), lwgeom_over_gserialized(), lwgeom_parse_wkt(), lwgeom_parser_result_free(), LWGEOM_pointn_linestring(), LWGEOM_recv(), lwgeom_remove_repeated_points_in_place(), LWGEOM_same(), LWGEOM_segmentize2d(), LWGEOM_SetEffectiveArea(), LWGEOM_shortestline2d(), LWGEOM_shortestline3d(), lwgeom_simplify(), LWGEOM_simplify2d(), lwgeom_simplify_in_place(), lwgeom_split_wrapx(), LWGEOM_startpoint_linestring(), lwgeom_subdivide_recursive(), LWGEOM_summary(), LWGEOM_to_BOX3D(), lwgeom_to_text(), LWGEOM_to_text(), LWGEOMFromEWKB(), LWGEOMFromTWKB(), lwt_AddPolygon(), lwt_ChangeEdgeGeom(), lwt_GetFaceEdges(), mvt_agg_transfn(), mvt_safe_clip_polygon_by_box(), perform_cluster_intersecting_test(), perform_cluster_within_distance_test(), pip_short_circuit(), pointonsurface(), polyhedralsurface_parse(), POSTGIS2GEOS(), POSTGIS2SFCGALGeometry(), POSTGIS2SFCGALPreparedGeometry(), RASTER_asRaster(), RASTER_clip(), RASTER_convex_hull(), RASTER_dumpAsPolygons(), RASTER_envelope(), RASTER_getPixelPolygons(), RASTER_nearestValue(), RASTER_setPixelValuesGeomval(), rect_tree_to_wkt(), rt_raster_compute_skewed_raster(), rt_raster_fully_within_distance(), rt_raster_gdal_polygonize(), rt_raster_intersects(), rt_raster_surface(), rt_raster_within_distance(), rtpg_setvaluesgv_arg_destroy(), sfcgal_is_solid(), sfcgal_make_solid(), SFCGALGeometry2POSTGIS(), ShpLoaderGenerateShapeRow(), ST_AddMeasure(), ST_AsMVTGeom(), ST_BoundingDiagonal(), ST_BuildArea(), ST_ClipByBox2d(), ST_ClosestPointOfApproach(), ST_ClusterDBSCAN(), ST_ClusterKMeans(), ST_CollectionExtract(), ST_CollectionHomogenize(), ST_CPAWithin(), ST_CurveToLine(), ST_DelaunayTriangles(), ST_DistanceCPA(), ST_FlipCoordinates(), ST_GeneratePoints(), ST_GeometricMedian(), ST_IsPolygonCCW(), ST_IsPolygonCW(), ST_IsValidTrajectory(), ST_LocateAlong(), ST_LocateBetween(), ST_LocateBetweenElevations(), ST_MinimumBoundingCircle(), ST_MinimumBoundingRadius(), ST_Node(), ST_Normalize(), ST_OffsetCurve(), ST_Points(), ST_QuantizeCoordinates(), ST_RemoveRepeatedPoints(), ST_Scale(), ST_SharedPaths(), ST_Snap(), ST_Split(), ST_SwapOrdinates(), ST_UnaryUnion(), ST_Voronoi(), ST_WrapX(), symdifference(), test_cannot_modify_read_only(), test_clone(), test_empty(), test_gbox_from_spherical_coordinates(), test_gbox_same_2d(), test_gbox_utils(), test_gdal_polygonize(), test_geos_linemerge(), test_geos_makevalid(), test_geos_noop(), test_geos_offsetcurve(), test_geos_offsetcurve_crash(), test_geos_subdivide(), test_grid(), test_gserialized_from_lwgeom(), test_gserialized_from_lwgeom_size(), test_gserialized_get_gbox_geocentric(), test_gserialized_is_empty(), test_gserialized_peek_gbox_p_fails_for_unsupported_cases(), test_gserialized_peek_gbox_p_gets_correct_box(), test_gserialized_peek_gbox_p_no_box_when_empty(), test_isclosed(), test_kmeans(), test_lwcollection_extract(), test_lwcurve_linearize(), test_lwgeom_area_sphere(), test_lwgeom_as_curve(), test_lwgeom_calculate_gbox(), test_lwgeom_check_geodetic(), test_lwgeom_clip_by_rect(), test_lwgeom_clone(), test_lwgeom_count_vertices(), test_lwgeom_delaunay_triangulation(), test_lwgeom_distance_sphere(), test_lwgeom_force_clockwise(), test_lwgeom_free(), test_lwgeom_from_gserialized(), test_lwgeom_is_empty(), test_lwgeom_is_trajectory(), test_lwgeom_locate_along(), test_lwgeom_make_valid(), test_lwgeom_node(), test_lwgeom_remove_repeated_points(), test_lwgeom_same(), test_lwgeom_scale(), test_lwgeom_segmentize2d(), test_lwgeom_segmentize_sphere(), test_lwgeom_simplify(), test_lwgeom_split(), test_lwgeom_tcpa(), test_lwgeom_voronoi_diagram(), test_lwgeom_voronoi_diagram_custom_envelope(), test_lwgeom_wrapx(), test_lwline_interpolate_points(), test_lwpoly_covers_point2d(), test_misc_area(), test_misc_count_vertices(), test_misc_force_2d(), test_misc_simplify(), test_misc_wkb(), test_mixed_rw_access(), test_modification(), test_no_memory_leaked_when_iterator_is_partially_used(), test_on_gser_lwgeom_count_vertices(), test_ordering(), test_point_count(), test_point_density(), test_ptarray_contains_point_sphere(), test_ptarray_contains_point_sphere_iowa(), test_raster_convex_hull(), test_raster_envelope_geom(), test_raster_perimeter(), test_rect_tree_contains_point(), test_rect_tree_distance_tree_case(), test_sfcgal_noop(), test_spheroid_area(), test_tree_circ_distance(), test_tree_circ_distance_threshold(), test_tree_circ_pip2(), test_unstroke(), test_wkb_leak(), tin_parse(), transform(), transform_geom(), tree_inter(), triangle_parse(), WKBFromLWGEOM(), wkt_parser_collection_finalize(), wkt_parser_compound_add_geom(), wkt_parser_compound_new(), wkt_parser_curvepolygon_add_ring(), wkt_parser_curvepolygon_finalize(), wkt_parser_polygon_add_ring(), wkt_parser_polygon_finalize(), and yydestruct().

Here is the call graph for this function: