shithub: choc

Download patch

ref: b34294b67473e8d3ad4b8204327e03d91bcd6214
parent: 690a424ae8e8f549e05ba678b725aead3572cda9
author: Fabian Greffrath <fabian@greffrath.com>
date: Thu Mar 26 14:26:32 EDT 2015

Add a wrapper with "void (void)" signature around G_CheckDemoStatus

This is meant to be passed over to I_AtExit() which expects an
argument of void type. It thus prevents undefined behaviour because
of the different signature of G_CheckDemoStatus() which is of boolean
type.

Fixes #519

--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -1151,6 +1151,11 @@
     }
 }
 
+static void G_CheckDemoStatusAtExit (void)
+{
+    G_CheckDemoStatus();
+}
+
 //
 // D_DoomMain
 //
@@ -1498,7 +1503,7 @@
         printf("Playing demo %s.\n", file);
     }
 
-    I_AtExit((atexit_func_t) G_CheckDemoStatus, true);
+    I_AtExit(G_CheckDemoStatusAtExit, true);
 
     // Generate the WAD hash table.  Speed things up a bit.
     W_GenerateHashTable();
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -1285,6 +1285,11 @@
 //
 //=============================================================================
 
+static void G_CheckDemoStatusAtExit (void)
+{
+    G_CheckDemoStatus();
+}
+
 //
 // D_DoomMain
 //
@@ -1634,7 +1639,7 @@
         printf("Playing demo %s.\n", file);
     }
 
-    I_AtExit((atexit_func_t) G_CheckDemoStatus, true);
+    I_AtExit(G_CheckDemoStatusAtExit, true);
 
     // Generate the WAD hash table.  Speed things up a bit.