diff --git a/source/lib/app_hooks.cpp b/source/lib/app_hooks.cpp index 9ef4e870b5..8868999b40 100644 --- a/source/lib/app_hooks.cpp +++ b/source/lib/app_hooks.cpp @@ -76,11 +76,9 @@ static AppHooks default_ah = ah; // register the specified hook function pointers. any of them that // are non-zero override the previous function pointer value // (these default to the stub hooks which are functional but basic). -void app_hooks_update(AppHooks* new_ah) +void app_hooks_update(const AppHooks& new_ah) { - ENSURE(new_ah); - -#define OVERRIDE_IF_NONZERO(HOOKNAME) if(new_ah->HOOKNAME) ah.HOOKNAME = new_ah->HOOKNAME; +#define OVERRIDE_IF_NONZERO(HOOKNAME) if(new_ah.HOOKNAME) ah.HOOKNAME = new_ah.HOOKNAME; OVERRIDE_IF_NONZERO(get_log_dir) OVERRIDE_IF_NONZERO(bundle_logs) OVERRIDE_IF_NONZERO(display_error) diff --git a/source/lib/app_hooks.h b/source/lib/app_hooks.h index 9213ed5f94..e90cd27a4e 100644 --- a/source/lib/app_hooks.h +++ b/source/lib/app_hooks.h @@ -153,7 +153,7 @@ struct AppHooks * override the previous function pointer value * (these default to the stub hooks which are functional but basic). **/ -void app_hooks_update(AppHooks* ah); +void app_hooks_update(const AppHooks& ah); /** * was the app hook changed via app_hooks_update from its default value? diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp index 7c67d43a04..4c4e28122d 100644 --- a/source/ps/GameSetup/GameSetup.cpp +++ b/source/ps/GameSetup/GameSetup.cpp @@ -208,12 +208,11 @@ void InitVfs(const CmdLineArgs& args) psSetLogDir(logs); // desired location for crashlog is now known. update AppHooks ASAP // (particularly before the following error-prone operations): - AppHooks hooks{ + app_hooks_update({ .get_log_dir = psLogDir, .bundle_logs = psBundleLogs, .display_error = psDisplayError - }; - app_hooks_update(&hooks); + }); g_VFS = CreateVfs();