diff options
| author | Thomas Knudsen <busstoptaktik@users.noreply.github.com> | 2018-02-01 10:22:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-01 10:22:08 +0100 |
| commit | 8f3345f39afedc3b025613852a54248f170a1b9f (patch) | |
| tree | 58772da8e08b8cc79eb42a192ff556482c43c7f4 /src/pj_malloc.c | |
| parent | 34917e08075c056213ec651bb9a523c1f023446d (diff) | |
| parent | 52c20a2e095c63fab6e4158c92b8995d882cbe62 (diff) | |
| download | PROJ-8f3345f39afedc3b025613852a54248f170a1b9f.tar.gz PROJ-8f3345f39afedc3b025613852a54248f170a1b9f.zip | |
Merge pull request #731 from busstoptaktik/4D-API_cs2cs-style
[WIP] 4D API cs2cs style
Diffstat (limited to 'src/pj_malloc.c')
| -rw-r--r-- | src/pj_malloc.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/pj_malloc.c b/src/pj_malloc.c index 63278a56..cfb7f658 100644 --- a/src/pj_malloc.c +++ b/src/pj_malloc.c @@ -162,6 +162,32 @@ void *pj_dealloc_params (PJ_CONTEXT *ctx, paralist *start, int errlev) { } + + +/************************************************************************/ +/* pj_free() */ +/* */ +/* This is the application callable entry point for destroying */ +/* a projection definition. It does work generic to all */ +/* projection types, and then calls the projection specific */ +/* free function, P->destructor(), to do local work. */ +/* In most cases P->destructor()==pj_default_destructor. */ +/************************************************************************/ + +void pj_free(PJ *P) { + if (0==P) + return; + /* 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, 0); +} + + + + /*****************************************************************************/ void *pj_default_destructor (PJ *P, int errlev) { /* Destructor */ /***************************************************************************** @@ -196,6 +222,14 @@ void *pj_default_destructor (PJ *P, int errlev) { /* Destructor */ /* free parameter list elements */ pj_dealloc_params (pj_get_ctx(P), P->params, errlev); + /* 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); + pj_dealloc (P->opaque); return pj_dealloc(P); } |
