From 0c52714def5105b549c784ddd12527a325cd4166 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 9 Aug 2014 01:46:00 +0100 Subject: [PATCH] Remove a loop that doesn't need to be there any more --- renderdoc/os/win32/win32_hook.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/renderdoc/os/win32/win32_hook.cpp b/renderdoc/os/win32/win32_hook.cpp index e81c6118b..43f325c20 100644 --- a/renderdoc/os/win32/win32_hook.cpp +++ b/renderdoc/os/win32/win32_hook.cpp @@ -302,16 +302,13 @@ FARPROC WINAPI Hooked_GetProcAddress(HMODULE mod, LPCSTR func) { FunctionHook search(func, NULL, NULL); - for(size_t i=0; i < it->second.FunctionHooks.size(); i++) + auto found = std::lower_bound(it->second.FunctionHooks.begin(), it->second.FunctionHooks.end(), search); + if(found != it->second.FunctionHooks.end() && !(search < *found)) { - auto found = std::lower_bound(it->second.FunctionHooks.begin(), it->second.FunctionHooks.end(), search); - if(found != it->second.FunctionHooks.end() && !(search < *found)) - { - if(found->origptr && *found->origptr == NULL) - *found->origptr = (void *)GetProcAddress(mod, func); + if(found->origptr && *found->origptr == NULL) + *found->origptr = (void *)GetProcAddress(mod, func); - return (FARPROC)found->hookptr; - } + return (FARPROC)found->hookptr; } } }