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_sconics.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_sconics.c')
| -rw-r--r-- | src/PJ_sconics.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/PJ_sconics.c b/src/PJ_sconics.c index 7f6e094c..b434c430 100644 --- a/src/PJ_sconics.c +++ b/src/PJ_sconics.c @@ -4,23 +4,26 @@ #include "projects.h" +enum Type { + EULER = 0, + MURD1 = 1, + MURD2 = 2, + MURD3 = 3, + PCONIC = 4, + TISSOT = 5, + VITK1 = 6 +}; + struct pj_opaque { double n; double rho_c; double rho_0; double sig; double c1, c2; - int type; + enum Type type; }; -#define EULER 0 -#define MURD1 1 -#define MURD2 2 -#define MURD3 3 -#define PCONIC 4 -#define TISSOT 5 -#define VITK1 6 #define EPS10 1.e-10 #define EPS 1e-10 #define LINE2 "\n\tConic, Sph\n\tlat_1= and lat_2=" @@ -106,7 +109,7 @@ static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, (and ellipsoidal?) inverse } -static PJ *setup(PJ *P, int type) { +static PJ *setup(PJ *P, enum Type type) { double del, cs; int err; struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); |
