diff options
| author | Aaron Puchert <aaron.puchert@sap.com> | 2017-11-17 17:46:34 +0100 |
|---|---|---|
| committer | Aaron Puchert <aaronpuchert@alice-dsl.net> | 2017-12-17 23:34:40 +0100 |
| commit | a07501a165e6f2521c9aa13fa63fab33cf67d876 (patch) | |
| tree | 846a2df69948cb6d4927c0c8d5b953786df5cb04 /src/PJ_pipeline.c | |
| parent | 95f8e749e712218ca49e4025fe6ab59ddf991c60 (diff) | |
| download | PROJ-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_pipeline.c')
| -rw-r--r-- | src/PJ_pipeline.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/PJ_pipeline.c b/src/PJ_pipeline.c index a0ef7c1e..2b012193 100644 --- a/src/PJ_pipeline.c +++ b/src/PJ_pipeline.c @@ -273,7 +273,7 @@ static size_t argc_params (paralist *params) { } /* Sentinel for argument list */ -static char argv_sentinel[] = "step"; +static char *argv_sentinel = "step"; /* turn paralist into argc/argv style argument list */ static char **argv_params (paralist *params, size_t argc) { @@ -363,7 +363,7 @@ PJ *OPERATION(pipeline,0) { /* Do some syntactical sanity checking */ for (i = 0; i < argc; i++) { - if (0==strcmp ("step", argv[i])) { + if (0==strcmp (argv_sentinel, argv[i])) { if (-1==i_pipeline) { proj_log_error (P, "Pipeline: +step before +proj=pipeline"); return destructor (P, PJD_ERR_MALFORMED_PIPELINE); |
