aboutsummaryrefslogtreecommitdiff
path: root/src/PJ_lsat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/PJ_lsat.c')
-rw-r--r--src/PJ_lsat.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/src/PJ_lsat.c b/src/PJ_lsat.c
index 15009d61..1b3778d6 100644
--- a/src/PJ_lsat.c
+++ b/src/PJ_lsat.c
@@ -1,5 +1,6 @@
/* based upon Snyder and Linck, USGS-NMD */
#define PJ_LIB__
+#include <errno.h>
#include <proj.h>
#include "projects.h"
@@ -148,40 +149,22 @@ 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(lsat) {
int land, 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;
land = pj_param(P->ctx, P->params, "ilsat").i;
- if (land <= 0 || land > 5) {
- proj_errno_set(P, PJD_ERR_LSAT_NOT_IN_RANGE);
- return freeup_new(P);
- }
+ if (land <= 0 || land > 5)
+ return pj_default_destructor(P, PJD_ERR_LSAT_NOT_IN_RANGE);
+
path = pj_param(P->ctx, P->params, "ipath").i;
- if (path <= 0 || path > (land <= 3 ? 251 : 233)) {
- proj_errno_set(P, PJD_ERR_PATH_NOT_IN_RANGE);
- return freeup_new(P);
- }
+ if (path <= 0 || path > (land <= 3 ? 251 : 233))
+ pj_default_destructor(P, PJD_ERR_PATH_NOT_IN_RANGE);
+
if (land <= 3) {
P->lam0 = DEG_TO_RAD * 128.87 - M_TWOPI / 251. * path;
Q->p22 = 103.2669323;