| 1800 | } |
| 1801 | |
| 1802 | static const char * |
| 1803 | CPLGetThreadLocalConfigOption(const char *pszKey, const char *pszDefault, |
| 1804 | bool bSubstituteNullValueMarkerWithNull) |
| 1805 | { |
| 1806 | #ifdef DEBUG_CONFIG_OPTIONS |
| 1807 | CPLAccessConfigOption(pszKey, TRUE); |
| 1808 | #endif |
| 1809 | |
| 1810 | const char *pszResult = nullptr; |
| 1811 | |
| 1812 | int bMemoryError = FALSE; |
| 1813 | char **papszTLConfigOptions = reinterpret_cast<char **>( |
| 1814 | CPLGetTLSEx(CTLS_CONFIGOPTIONS, &bMemoryError)); |
| 1815 | if (papszTLConfigOptions != nullptr) |
| 1816 | pszResult = CSLFetchNameValue(papszTLConfigOptions, pszKey); |
| 1817 | |
| 1818 | if (pszResult == nullptr || (bSubstituteNullValueMarkerWithNull && |
| 1819 | strcmp(pszResult, CPL_NULL_VALUE) == 0)) |
| 1820 | return pszDefault; |
| 1821 | |
| 1822 | return pszResult; |
| 1823 | } |
| 1824 | |
| 1825 | /************************************************************************/ |
| 1826 | /* CPLGetGlobalConfigOption() */ |