diff options
| author | Aaron Puchert <aaron.puchert@sap.com> | 2017-11-06 17:52:29 +0100 |
|---|---|---|
| committer | Aaron Puchert <aaron.puchert@sap.com> | 2017-11-06 18:04:54 +0100 |
| commit | c0c95e33abf2f724e5827cbf41ede41e2939e188 (patch) | |
| tree | e14c3a6ce8322d3185670ce51d7a376152c25678 /src/PJ_stere.c | |
| parent | e7e86d14f86eb66365d6aa725c5e9b496b3ba7f7 (diff) | |
| download | PROJ-c0c95e33abf2f724e5827cbf41ede41e2939e188.tar.gz PROJ-c0c95e33abf2f724e5827cbf41ede41e2939e188.zip | |
Use enumerations where appropriate
Enumerations have the following advantages over #define:
- they clearly connect a variable and the allowed constants,
- the meaning of code is not obfuscated by integer values,
- they are visible to the compiler, which can warn about (possibly)
incorrect usage.
There should be no functional change.
Diffstat (limited to 'src/PJ_stere.c')
| -rw-r--r-- | src/PJ_stere.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/PJ_stere.c b/src/PJ_stere.c index 02b73507..500b512d 100644 --- a/src/PJ_stere.c +++ b/src/PJ_stere.c @@ -7,12 +7,19 @@ PROJ_HEAD(stere, "Stereographic") "\n\tAzi, Sph&Ell\n\tlat_ts="; PROJ_HEAD(ups, "Universal Polar Stereographic") "\n\tAzi, Sph&Ell\n\tsouth"; +enum Mode { + S_POLE = 0, + N_POLE = 1, + OBLIQ = 2, + EQUIT = 3 +}; + struct pj_opaque { double phits; double sinX1; double cosX1; double akm1; - int mode; + enum Mode mode; }; #define sinph0 P->opaque->sinX1 @@ -21,10 +28,6 @@ struct pj_opaque { #define TOL 1.e-8 #define NITER 8 #define CONV 1.e-10 -#define S_POLE 0 -#define N_POLE 1 -#define OBLIQ 2 -#define EQUIT 3 static double ssfn_ (double phit, double sinphi, double eccen) { sinphi *= eccen; |
