MCPcopy Create free account
hub / github.com/OSGeo/gdal / CPLGetErrorContext

Function CPLGetErrorContext

port/cpl_error.cpp:104–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102/************************************************************************/
103
104static CPLErrorContext *CPLGetErrorContext()
105
106{
107 int bError = FALSE;
108 CPLErrorContext *psCtx = reinterpret_cast<CPLErrorContext *>(
109 CPLGetTLSEx(CTLS_ERRORCONTEXT, &bError));
110 if (bError)
111 return nullptr;
112
113 if (psCtx == nullptr)
114 {
115 psCtx = static_cast<CPLErrorContext *>(
116 VSICalloc(sizeof(CPLErrorContext), 1));
117 if (psCtx == nullptr)
118 {
119 fprintf(stderr, "Out of memory attempting to report error.\n");
120 return nullptr;
121 }
122 psCtx->eLastErrType = CE_None;
123 psCtx->nLastErrMsgMax = sizeof(psCtx->szLastErrMsg);
124 CPLSetTLS(CTLS_ERRORCONTEXT, psCtx, TRUE);
125 }
126
127 return psCtx;
128}
129
130/************************************************************************/
131/* CPLGetErrorHandlerUserData() */

Callers 15

CPLGetErrorHandlerFunction · 0.85
CPLErrorVFunction · 0.85
CPLvDebugFunction · 0.85
CPLDebugProgressFunction · 0.85
CPLErrorSetStateFunction · 0.85

Calls 3

CPLGetTLSExFunction · 0.85
VSICallocFunction · 0.85
CPLSetTLSFunction · 0.85

Tested by

no test coverage detected