aboutsummaryrefslogtreecommitdiff
path: root/src/ctx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ctx.cpp')
-rw-r--r--src/ctx.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ctx.cpp b/src/ctx.cpp
index 097633ae..cc9df6c3 100644
--- a/src/ctx.cpp
+++ b/src/ctx.cpp
@@ -91,13 +91,16 @@ pj_ctx pj_ctx::createDefault()
ctx.logger = pj_stderr_logger;
NS_PROJ::FileManager::fillDefaultNetworkInterface(&ctx);
- if( getenv("PROJ_DEBUG") != nullptr )
+ const char* projDebug = getenv("PROJ_DEBUG");
+ if( projDebug != nullptr )
{
- if( atoi(getenv("PROJ_DEBUG")) >= -PJ_LOG_TRACE )
- ctx.debug_level = atoi(getenv("PROJ_DEBUG"));
+ const int debugLevel = atoi(projDebug);
+ if( debugLevel >= -PJ_LOG_TRACE )
+ ctx.debug_level = debugLevel;
else
ctx.debug_level = PJ_LOG_TRACE;
}
+
return ctx;
}