aboutsummaryrefslogtreecommitdiff
path: root/src/malloc.cpp
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2020-11-18 09:57:42 +0100
committerKristian Evers <kristianevers@gmail.com>2020-11-20 16:40:40 +0100
commit43efca4ab87fb37a0931edcb6be11c0bd3784098 (patch)
treeb334bdb4d6898b740fbb4f300e6753a3d0878aff /src/malloc.cpp
parentddb3b8da0756acbb8713aeb452de209eb350e996 (diff)
downloadPROJ-43efca4ab87fb37a0931edcb6be11c0bd3784098.tar.gz
PROJ-43efca4ab87fb37a0931edcb6be11c0bd3784098.zip
Remove pj_free() and move it's functional parts to proj_destroy()
Diffstat (limited to 'src/malloc.cpp')
-rw-r--r--src/malloc.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/malloc.cpp b/src/malloc.cpp
index b1bcea1d..590dd27f 100644
--- a/src/malloc.cpp
+++ b/src/malloc.cpp
@@ -174,7 +174,7 @@ void *pj_dealloc_params (PJ_CONTEXT *ctx, paralist *start, int errlev) {
/************************************************************************/
-/* pj_free() */
+/* proj_destroy() */
/* */
/* This is the application callable entry point for destroying */
/* a projection definition. It does work generic to all */
@@ -183,15 +183,16 @@ void *pj_dealloc_params (PJ_CONTEXT *ctx, paralist *start, int errlev) {
/* In most cases P->destructor()==pj_default_destructor. */
/************************************************************************/
-void pj_free(PJ *P) {
+PJ *proj_destroy(PJ *P) {
if (nullptr==P || !P->destructor)
- return;
+ return nullptr;
/* free projection parameters - all the hard work is done by */
/* pj_default_destructor, which is supposed */
/* to be called as the last step of the local destructor */
/* pointed to by P->destructor. In most cases, */
/* pj_default_destructor actually *is* what is pointed to */
P->destructor (P, proj_errno(P));
+ return nullptr;
}
/*****************************************************************************/
@@ -246,12 +247,12 @@ PJ *pj_default_destructor (PJ *P, int errlev) { /* Destructor */
pj_dealloc (P->def_full);
/* free the cs2cs emulation elements */
- pj_free (P->axisswap);
- pj_free (P->helmert);
- pj_free (P->cart);
- pj_free (P->cart_wgs84);
- pj_free (P->hgridshift);
- pj_free (P->vgridshift);
+ proj_destroy (P->axisswap);
+ proj_destroy (P->helmert);
+ proj_destroy (P->cart);
+ proj_destroy (P->cart_wgs84);
+ proj_destroy (P->hgridshift);
+ proj_destroy (P->vgridshift);
pj_dealloc (static_cast<struct pj_opaque*>(P->opaque));
delete P;