summaryrefslogtreecommitdiffhomepage
path: root/src/nomute.c
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2024-08-03 23:40:31 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2024-08-23 20:37:37 +0100
commit83da606072ce272eb053d4e1497d77e647cfecae (patch)
tree71d0110881ff8685184c5f4ab720cc8d49c24678 /src/nomute.c
parentacbd30e0427b16f885f96aed59881ec04eff25bc (diff)
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!
Diffstat (limited to 'src/nomute.c')
-rw-r--r--src/nomute.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nomute.c b/src/nomute.c
index 6a42d46..4e5bcc4 100644
--- a/src/nomute.c
+++ b/src/nomute.c
@@ -26,6 +26,7 @@
#include "con_.h"
#include "errmsg.h"
#include "feature.h"
+#include "langext.h"
#include "os.h"
#include "sst.h"
@@ -44,7 +45,7 @@ static con_cmdcbv1 snd_restart_cb = 0;
// unless we were loaded later with plugin_load in which case we actually do.
static bool skiprestart;
static void losefocuscb(struct con_var *v) {
- if (!skiprestart) snd_restart_cb();
+ if_hot (!skiprestart) snd_restart_cb();
skiprestart = false;
}
@@ -65,14 +66,15 @@ PREINIT {
INIT {
skiprestart = sst_earlyloaded; // see above
IDirectSound *ds_obj = 0;
- if (DirectSoundCreate(0, &ds_obj, 0) != DS_OK) {
+ if_cold (DirectSoundCreate(0, &ds_obj, 0) != DS_OK) {
// XXX: can this error be usefully stringified?
errmsg_errorx("couldn't create IDirectSound instance");
return false;
}
ds_vt = ds_obj->lpVtbl;
ds_obj->lpVtbl->Release(ds_obj);
- if (!os_mprot(&ds_vt->CreateSoundBuffer, sizeof(void *), PAGE_READWRITE)) {
+ if_cold (!os_mprot(&ds_vt->CreateSoundBuffer, sizeof(void *),
+ PAGE_READWRITE)) {
errmsg_errorsys("couldn't make virtual table writable");
return false;
}
@@ -81,7 +83,7 @@ INIT {
snd_mute_losefocus->base.flags &= ~CON_HIDDEN;
struct con_cmd *snd_restart = con_findcmd("snd_restart");
- if (snd_restart) {
+ if_hot (snd_restart) {
snd_restart_cb = con_getcmdcbv1(snd_restart);
snd_mute_losefocus->cb = &losefocuscb;
}