aboutsummaryrefslogtreecommitdiff
path: root/src/ctx.cpp
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2020-11-17 12:54:24 +0100
committerKristian Evers <kristianevers@gmail.com>2020-11-20 16:40:40 +0100
commita74b985b5006c2d279353a245cfcb850cf7fcc94 (patch)
tree0f71f55671b6014893df2d0bf61804bcbbdc9c8c /src/ctx.cpp
parent7f79fe7325a74d2a9eac93d7081a107ae54bb877 (diff)
downloadPROJ-a74b985b5006c2d279353a245cfcb850cf7fcc94.tar.gz
PROJ-a74b985b5006c2d279353a245cfcb850cf7fcc94.zip
Remove pj_ctx_* functions and use their proj_context counterparts
Diffstat (limited to 'src/ctx.cpp')
-rw-r--r--src/ctx.cpp127
1 files changed, 11 insertions, 116 deletions
diff --git a/src/ctx.cpp b/src/ctx.cpp
index d3eee39f..8e25db2a 100644
--- a/src/ctx.cpp
+++ b/src/ctx.cpp
@@ -54,13 +54,17 @@ PJ_CONTEXT* pj_get_ctx( PJ *pj )
}
/************************************************************************/
-/* pj_set_ctx() */
-/* */
-/* Note we do not deallocate the old context! */
+/* proj_assign_context() */
/************************************************************************/
-void pj_set_ctx( PJ *pj, PJ_CONTEXT *ctx )
-
+/** \brief Re-assign a context to a PJ* object.
+ *
+ * This may be useful if the PJ* has been created with a context that is
+ * thread-specific, and is later used in another thread. In that case,
+ * the user may want to assign another thread-specific context to the
+ * object.
+ */
+void proj_assign_context( PJ* pj, PJ_CONTEXT *ctx )
{
if (pj==nullptr)
return;
@@ -71,24 +75,9 @@ void pj_set_ctx( PJ *pj, PJ_CONTEXT *ctx )
}
for( const auto &alt: pj->alternativeCoordinateOperations )
{
- pj_set_ctx(alt.pj, ctx);
+ proj_assign_context(alt.pj, ctx);
}
-}
-/************************************************************************/
-/* proj_assign_context() */
-/************************************************************************/
-
-/** \brief Re-assign a context to a PJ* object.
- *
- * This may be useful if the PJ* has been created with a context that is
- * thread-specific, and is later used in another thread. In that case,
- * the user may want to assign another thread-specific context to the
- * object.
- */
-void proj_assign_context( PJ* pj, PJ_CONTEXT *ctx )
-{
- pj_set_ctx( pj, ctx );
}
/************************************************************************/
@@ -213,16 +202,6 @@ pj_ctx::~pj_ctx()
}
/************************************************************************/
-/* pj_ctx_alloc() */
-/************************************************************************/
-
-PJ_CONTEXT* pj_ctx_alloc()
-
-{
- return new (std::nothrow) pj_ctx(*pj_get_default_ctx());
-}
-
-/************************************************************************/
/* proj_context_clone() */
/* Create a new context based on a custom context */
/************************************************************************/
@@ -230,93 +209,9 @@ PJ_CONTEXT* pj_ctx_alloc()
PJ_CONTEXT* proj_context_clone (PJ_CONTEXT *ctx)
{
if (nullptr==ctx)
- return pj_ctx_alloc ();
+ return proj_context_create();
return new (std::nothrow) pj_ctx(*ctx);
}
-/************************************************************************/
-/* pj_ctx_free() */
-/************************************************************************/
-
-void pj_ctx_free( PJ_CONTEXT *ctx )
-
-{
- delete ctx;
-}
-
-/************************************************************************/
-/* pj_ctx_get_errno() */
-/************************************************************************/
-
-int pj_ctx_get_errno( PJ_CONTEXT *ctx )
-{
- if (nullptr==ctx)
- return pj_get_default_ctx ()->last_errno;
- return ctx->last_errno;
-}
-
-/************************************************************************/
-/* pj_ctx_set_errno() */
-/* */
-/* Also sets the global errno */
-/************************************************************************/
-
-void pj_ctx_set_errno( PJ_CONTEXT *ctx, int new_errno )
-
-{
- ctx->last_errno = new_errno;
- if( new_errno == 0 )
- return;
- errno = new_errno;
- pj_errno = new_errno;
-}
-
-/************************************************************************/
-/* pj_ctx_set_debug() */
-/************************************************************************/
-
-void pj_ctx_set_debug( PJ_CONTEXT *ctx, int new_debug )
-
-{
- if (nullptr==ctx)
- return;
- ctx->debug_level = new_debug;
-}
-
-/************************************************************************/
-/* pj_ctx_set_logger() */
-/************************************************************************/
-
-void pj_ctx_set_logger( PJ_CONTEXT *ctx, void (*new_logger)(void*,int,const char*) )
-
-{
- if (nullptr==ctx)
- return;
- ctx->logger = new_logger;
-}
-
-/************************************************************************/
-/* pj_ctx_set_app_data() */
-/************************************************************************/
-
-void pj_ctx_set_app_data( PJ_CONTEXT *ctx, void *new_app_data )
-
-{
- if (nullptr==ctx)
- return;
- ctx->logger_app_data = new_app_data;
-}
-
-/************************************************************************/
-/* pj_ctx_get_app_data() */
-/************************************************************************/
-
-void *pj_ctx_get_app_data( PJ_CONTEXT *ctx )
-
-{
- if (nullptr==ctx)
- return nullptr;
- return ctx->logger_app_data;
-}