From 83da606072ce272eb053d4e1497d77e647cfecae Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sat, 3 Aug 2024 23:40:31 +0100 Subject: Revise syntax macros and add a ton of branch hints My new programming style is branch hints. All non-confusing branches must be hinted when I can be bothered. It's faster, sometimes, maybe. Also, start trying to use more signed sizes in at least some of the places where it makes sense. Unsigned sizes are surprisingly error-prone! --- src/kvsys.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/kvsys.c') diff --git a/src/kvsys.c b/src/kvsys.c index fc10b93..31652f3 100644 --- a/src/kvsys.c +++ b/src/kvsys.c @@ -24,6 +24,7 @@ #include "gametype.h" #include "hook.h" #include "kvsys.h" +#include "langext.h" #include "mem.h" #include "os.h" #include "vcall.h" @@ -31,7 +32,7 @@ FEATURE() -IMPORT void *KeyValuesSystem(void); // vstlib symbol +void *KeyValuesSystem(void); // vstlib symbol static void *kvs; static int vtidx_GetSymbolForString = 3, vtidx_GetStringForSymbol = 4; static bool iskvv2 = false; @@ -101,7 +102,7 @@ INIT { if (GAMETYPE_MATCHES(L4D2x)) { void **kvsvt = mem_loadptr(kvs); detectabichange(kvsvt); - if (!os_mprot(kvsvt + vtidx_GetStringForSymbol, sizeof(void *), + if_cold (!os_mprot(kvsvt + vtidx_GetStringForSymbol, sizeof(void *), PAGE_READWRITE)) { errmsg_warnx("couldn't make KeyValuesSystem vtable writable"); errmsg_note("won't be able to prevent any nag messages"); -- cgit v1.2.3-54-g00ecf