Skip to content

Commit d88ad80

Browse files
author
nitrocaster
committed
Replace LoadLibrary+GetProcAddress to direct call (HeapSetInformation).
1 parent 0c84242 commit d88ad80

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

src/xrEngine/main.cpp

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -448,27 +448,16 @@ int APIENTRY WinMain_impl(HINSTANCE hInstance,
448448

449449
if (!IsDebuggerPresent())
450450
{
451-
452-
HMODULE const kernel32 = LoadLibrary("kernel32.dll");
453-
R_ASSERT(kernel32);
454-
455-
typedef BOOL(__stdcall*HeapSetInformation_type) (HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T);
456-
HeapSetInformation_type const heap_set_information =
457-
(HeapSetInformation_type)GetProcAddress(kernel32, "HeapSetInformation");
458-
if (heap_set_information)
459-
{
460-
ULONG HeapFragValue = 2;
451+
ULONG HeapFragValue = 2;
461452
#ifdef DEBUG
462-
BOOL const result =
453+
BOOL const result =
463454
#endif // #ifdef DEBUG
464-
heap_set_information(
465-
GetProcessHeap(),
466-
HeapCompatibilityInformation,
467-
&HeapFragValue,
468-
sizeof(HeapFragValue)
469-
);
470-
VERIFY2(result, "can't set process heap low fragmentation");
471-
}
455+
HeapSetInformation(
456+
GetProcessHeap(),
457+
HeapCompatibilityInformation,
458+
&HeapFragValue,
459+
sizeof(HeapFragValue));
460+
VERIFY2(result, "can't set process heap low fragmentation");
472461
}
473462
#ifndef DEDICATED_SERVER
474463
// Check for another instance

0 commit comments

Comments
 (0)