From c7cc57d689d86193675c3c61188b70d734487b00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= <gustaf@hanicef.me>
Date: Thu, 23 Jan 2025 18:23:21 +0100
Subject: [PATCH 1/2] Inline P_MobjWasRemoved

---
 src/p_local.h | 8 +++++++-
 src/p_mobj.c  | 9 ---------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/p_local.h b/src/p_local.h
index de519b211b..2c4b12a449 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -289,7 +289,6 @@ void P_RecalcPrecipInSector(sector_t *sector);
 void P_PrecipitationEffects(void);
 
 void P_RemoveMobj(mobj_t *th);
-boolean P_MobjWasRemoved(mobj_t *th);
 void P_RemoveSavegameMobj(mobj_t *th);
 boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
 void P_RunShields(void);
@@ -301,6 +300,13 @@ boolean P_CheckSkyHit(mobj_t *mo, line_t *line);
 void P_PushableThinker(mobj_t *mobj);
 void P_SceneryThinker(mobj_t *mobj);
 
+// This does not need to be added to Lua.
+// To test it in Lua, check mobj.valid
+static inline boolean P_MobjWasRemoved(mobj_t *mobj)
+{
+	return mobj == NULL || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker;
+}
+
 
 fixed_t P_MobjFloorZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean lowest, boolean perfect);
 fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean lowest, boolean perfect);
diff --git a/src/p_mobj.c b/src/p_mobj.c
index 85ae8b256f..9ddc7fd8e6 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -11273,15 +11273,6 @@ void P_RemoveMobj(mobj_t *mobj)
 #endif
 }
 
-// This does not need to be added to Lua.
-// To test it in Lua, check mobj.valid
-boolean P_MobjWasRemoved(mobj_t *mobj)
-{
-	if (mobj && mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker)
-		return false;
-	return true;
-}
-
 void P_RemovePrecipMobj(precipmobj_t *mobj)
 {
 	// unlink from sector and block lists
-- 
GitLab


From 3470b930536a47362451e3ccaeea26515975fbe9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= <gustaf@hanicef.me>
Date: Thu, 23 Jan 2025 19:40:22 +0100
Subject: [PATCH 2/2] Use inline attributes

---
 src/p_local.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/p_local.h b/src/p_local.h
index 2c4b12a449..0078a567d5 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -302,7 +302,7 @@ void P_SceneryThinker(mobj_t *mobj);
 
 // This does not need to be added to Lua.
 // To test it in Lua, check mobj.valid
-static inline boolean P_MobjWasRemoved(mobj_t *mobj)
+FUNCINLINE static ATTRINLINE boolean P_MobjWasRemoved(mobj_t *mobj)
 {
 	return mobj == NULL || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker;
 }
-- 
GitLab