Fix global variable namings.

This commit is contained in:
Skyth 2024-12-15 15:16:41 +03:00
parent 55f50f3023
commit 95951d0e5d

View file

@ -901,49 +901,49 @@ DWORD KeWaitForSingleObject(XDISPATCHER_HEADER* Object, DWORD WaitReason, DWORD
return WaitForSingleObjectEx(handle, timeout, Alertable); return WaitForSingleObjectEx(handle, timeout, Alertable);
} }
static thread_local std::vector<uint32_t> KeTlsValues; static thread_local std::vector<uint32_t> g_tlsValues;
static std::vector<size_t> KeTlsFreeIndices; static std::vector<size_t> g_tlsFreeIndices;
static size_t KeTlsNextIndex = 0; static size_t g_tlsNextIndex = 0;
static Mutex KeTlsAllocationMutex; static Mutex g_tlsAllocationMutex;
static void KeTlsEnsureTlsCapacity(size_t index) static void KeTlsEnsureTlsCapacity(size_t index)
{ {
if (KeTlsValues.size() <= index) if (g_tlsValues.size() <= index)
{ {
KeTlsValues.resize(index + 1, 0); g_tlsValues.resize(index + 1, 0);
} }
} }
uint32_t KeTlsGetValue(DWORD dwTlsIndex) uint32_t KeTlsGetValue(DWORD dwTlsIndex)
{ {
KeTlsEnsureTlsCapacity(dwTlsIndex); KeTlsEnsureTlsCapacity(dwTlsIndex);
return KeTlsValues[dwTlsIndex]; return g_tlsValues[dwTlsIndex];
} }
BOOL KeTlsSetValue(DWORD dwTlsIndex, DWORD lpTlsValue) BOOL KeTlsSetValue(DWORD dwTlsIndex, DWORD lpTlsValue)
{ {
KeTlsEnsureTlsCapacity(dwTlsIndex); KeTlsEnsureTlsCapacity(dwTlsIndex);
KeTlsValues[dwTlsIndex] = lpTlsValue; g_tlsValues[dwTlsIndex] = lpTlsValue;
return TRUE; return TRUE;
} }
DWORD KeTlsAlloc() DWORD KeTlsAlloc()
{ {
std::lock_guard<Mutex> lock(KeTlsAllocationMutex); std::lock_guard<Mutex> lock(g_tlsAllocationMutex);
if (!KeTlsFreeIndices.empty()) if (!g_tlsFreeIndices.empty())
{ {
size_t index = KeTlsFreeIndices.back(); size_t index = g_tlsFreeIndices.back();
KeTlsFreeIndices.pop_back(); g_tlsFreeIndices.pop_back();
return index; return index;
} }
return KeTlsNextIndex++; return g_tlsNextIndex++;
} }
BOOL KeTlsFree(DWORD dwTlsIndex) BOOL KeTlsFree(DWORD dwTlsIndex)
{ {
std::lock_guard<Mutex> lock(KeTlsAllocationMutex); std::lock_guard<Mutex> lock(g_tlsAllocationMutex);
KeTlsFreeIndices.push_back(dwTlsIndex); g_tlsFreeIndices.push_back(dwTlsIndex);
return TRUE; return TRUE;
} }