diff options
| author | Thomas Knudsen <thokn@sdfe.dk> | 2017-09-27 13:54:30 +0200 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2017-09-28 10:52:30 +0200 |
| commit | fa318ed5db0e00bf0a9fb3c18852efb44a095427 (patch) | |
| tree | 8fbc595b7aa2019a40f4d1ea58dea47d81f5d775 /src/pj_malloc.c | |
| parent | 6ea5a3cbe601bc14cb18614fdaa97092abf96f3c (diff) | |
| download | PROJ-fa318ed5db0e00bf0a9fb3c18852efb44a095427.tar.gz PROJ-fa318ed5db0e00bf0a9fb3c18852efb44a095427.zip | |
Support a default destructor for PJ objects
Diffstat (limited to 'src/pj_malloc.c')
| -rw-r--r-- | src/pj_malloc.c | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/src/pj_malloc.c b/src/pj_malloc.c index 330b14a6..52cf7deb 100644 --- a/src/pj_malloc.c +++ b/src/pj_malloc.c @@ -115,7 +115,7 @@ pointer" to signal an error in a multi level allocation: /*****************************************************************************/ -static void *pj_freeup_msg_plain (PJ *P, int errlev) { /* Destructor */ +void *pj_default_destructor (PJ *P, int errlev) { /* Destructor */ /***************************************************************************** Does memory deallocation for "plain" PJ objects, i.e. that vast majority of PJs where the opaque object does not contain any additionally @@ -123,54 +123,13 @@ static void *pj_freeup_msg_plain (PJ *P, int errlev) { /* Destructor */ ******************************************************************************/ if (0==P) return 0; - + if (0!=errlev) pj_ctx_set_errno (P->ctx, errlev); - + if (0==P->opaque) return pj_dealloc (P); pj_dealloc (P->opaque); return pj_dealloc(P); } - - -/*****************************************************************************/ -void pj_freeup_plain (PJ *P) { -/***************************************************************************** - Adapts pj_freeup_msg_plain to the format defined for the callback in - the PJ object. - - i.e. reduces most instances of projection deallocation code to: - - static void freeup (PJ *P) { - pj_freeup_plain (P); - return; - } - - rather than: - - static void *freeup_msg_add (PJ *P, int errlev) { - if (0==P) - return 0; - pj_ctx_set_errno (P->ctx, errlev); - - if (0==P->opaque) - return pj_dealloc (P); - - (* projection specific deallocation goes here *) - - pj_dealloc (P->opaque); - return pj_dealloc(P); - } - - (* Adapts pipeline_freeup to the format defined for the PJ object *) - static void freeup_msg_add (PJ *P) { - freeup_new_add (P, 0); - return; - } - - ******************************************************************************/ - pj_freeup_msg_plain (P, 0); - return; - } |
