aboutsummaryrefslogtreecommitdiff
path: root/src/PJ_misrsom.c
diff options
context:
space:
mode:
authorThomas Knudsen <busstoptaktik@users.noreply.github.com>2017-10-06 18:56:12 +0200
committerGitHub <noreply@github.com>2017-10-06 18:56:12 +0200
commit202455448868a8a7d24dd7ba3cfa4fa9580c25c5 (patch)
treedf66e34efc3a8177249c35e29d9169855aea94bf /src/PJ_misrsom.c
parent0c2f14e53de134e3bdecee45f7bcf9bdb1811432 (diff)
parentee0e2a0ff7315b3e77e5e570b566a735ec6a817a (diff)
downloadPROJ-202455448868a8a7d24dd7ba3cfa4fa9580c25c5.tar.gz
PROJ-202455448868a8a7d24dd7ba3cfa4fa9580c25c5.zip
Merge pull request #583 from busstoptaktik/destructor
Introduce a default destructor for PJ objects
Diffstat (limited to 'src/PJ_misrsom.c')
-rw-r--r--src/PJ_misrsom.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/PJ_misrsom.c b/src/PJ_misrsom.c
index 49be1669..5c5a226f 100644
--- a/src/PJ_misrsom.c
+++ b/src/PJ_misrsom.c
@@ -21,6 +21,7 @@
*****************************************************************************/
/* based upon Snyder and Linck, USGS-NMD */
#define PJ_LIB__
+#include <errno.h>
#include <proj.h>
#include "projects.h"
@@ -164,36 +165,19 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */
}
-static void *freeup_new (PJ *P) { /* Destructor */
- if (0==P)
- return 0;
- if (0==P->opaque)
- return pj_dealloc (P);
-
- pj_dealloc (P->opaque);
- return pj_dealloc(P);
-}
-
-static void freeup (PJ *P) {
- freeup_new (P);
- return;
-}
-
-
PJ *PROJECTION(misrsom) {
int path;
double lam, alf, esc, ess;
struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque));
if (0==Q)
- return freeup_new (P);
+ return pj_default_destructor (P, ENOMEM);
P->opaque = Q;
path = pj_param(P->ctx, P->params, "ipath").i;
- if (path <= 0 || path > 233) {
- proj_errno_set(P, PJD_ERR_PATH_NOT_IN_RANGE);
- return freeup_new(P);
- }
+ if (path <= 0 || path > 233)
+ return pj_default_destructor(P, PJD_ERR_PATH_NOT_IN_RANGE);
+
P->lam0 = DEG_TO_RAD * 129.3056 - M_TWOPI / 233. * path;
alf = 98.30382 * DEG_TO_RAD;
Q->p22 = 98.88 / 1440.0;