From 4bcc34f01ce98a37fecdac2c9c6ba70507b692e7 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Wed, 4 Jan 2017 19:13:58 +0100 Subject: [PATCH] Move openings deinit to r_memory --- src/swrenderer/r_main.cpp | 9 +-------- src/swrenderer/r_memory.cpp | 9 +++++++++ src/swrenderer/r_memory.h | 1 + 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/swrenderer/r_main.cpp b/src/swrenderer/r_main.cpp index cfb9daf51b..a5978b5a8c 100644 --- a/src/swrenderer/r_main.cpp +++ b/src/swrenderer/r_main.cpp @@ -102,7 +102,6 @@ static void R_ShutdownRenderer(); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- -extern short *openings; extern int fuzzviewheight; @@ -391,13 +390,7 @@ static void R_ShutdownRenderer() R_DeinitSprites(); R_DeinitPlanes(); Clip3DFloors::Instance()->Cleanup(); - // Free openings - if (openings != NULL) - { - M_Free (openings); - openings = NULL; - } - + R_DeinitOpenings(); R_FreeDrawSegs(); } diff --git a/src/swrenderer/r_memory.cpp b/src/swrenderer/r_memory.cpp index dd5fd83f88..0b3d3c1d4b 100644 --- a/src/swrenderer/r_memory.cpp +++ b/src/swrenderer/r_memory.cpp @@ -61,4 +61,13 @@ namespace swrenderer { lastopening = 0; } + + void R_DeinitOpenings() + { + if (openings != nullptr) + { + M_Free(openings); + openings = nullptr; + } + } } diff --git a/src/swrenderer/r_memory.h b/src/swrenderer/r_memory.h index fc0c845e29..5df7504807 100644 --- a/src/swrenderer/r_memory.h +++ b/src/swrenderer/r_memory.h @@ -19,4 +19,5 @@ namespace swrenderer ptrdiff_t R_NewOpening(ptrdiff_t len); void R_FreeOpenings(); + void R_DeinitOpenings(); }