aboutsummaryrefslogtreecommitdiff
path: root/src/pj_init.c
diff options
context:
space:
mode:
authorAaron Puchert <aaron.puchert@sap.com>2017-11-17 17:46:34 +0100
committerAaron Puchert <aaronpuchert@alice-dsl.net>2017-12-17 23:34:40 +0100
commita07501a165e6f2521c9aa13fa63fab33cf67d876 (patch)
tree846a2df69948cb6d4927c0c8d5b953786df5cb04 /src/pj_init.c
parent95f8e749e712218ca49e4025fe6ab59ddf991c60 (diff)
downloadPROJ-a07501a165e6f2521c9aa13fa63fab33cf67d876.tar.gz
PROJ-a07501a165e6f2521c9aa13fa63fab33cf67d876.zip
Declare non-local variables as const where possible
Having non-const variables of static lifetime or even global scope is usually a bad idea. These variables are inherently constants, and this should be enforced. This required marking some functions as not modifying input parameters and marking some pointers as pointers to const. One advantage is that the compiler usually puts const static variables in a read-only code segment, so they can't be modified physically. This can be verified with `nm` (on POSIX systems). To avoid changes to the public API, functions returning non-const pointers to data tables were left intact, but the returned data may not be modified. Internally we prefer using the proj_list_* functions over the pj_get_*_ref functions, because the former return const pointers.
Diffstat (limited to 'src/pj_init.c')
-rw-r--r--src/pj_init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pj_init.c b/src/pj_init.c
index 8f4eb477..7e885575 100644
--- a/src/pj_init.c
+++ b/src/pj_init.c
@@ -639,7 +639,7 @@ pj_init_ctx(projCtx ctx, int argc, char **argv) {
/* Axis orientation */
if( (pj_param(ctx, start,"saxis").s) != NULL )
{
- static const char *axis_legal = "ewnsud";
+ const char *axis_legal = "ewnsud";
const char *axis_arg = pj_param(ctx, start,"saxis").s;
if( strlen(axis_arg) != 3 )
return pj_default_destructor (PIN, PJD_ERR_AXIS);