Skip to content

Commit bd50031

Browse files
committed
Use unique_ptr for FS and EFS ptr.
1 parent 243c7c7 commit bd50031

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/xrCore/FileSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "commdlg.h"
1010
#include "vfw.h"
1111

12-
EFS_Utils* xr_EFS = NULL;
12+
std::unique_ptr<EFS_Utils> xr_EFS;
1313
//----------------------------------------------------
1414
EFS_Utils::EFS_Utils() {}
1515
EFS_Utils::~EFS_Utils() {}

src/xrCore/FileSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class XRCORE_API EFS_Utils
4242
static xr_string ExtractFileExt(LPCSTR src);
4343
static xr_string ExcludeBasePath(LPCSTR full_path, LPCSTR excl_path);
4444
};
45-
extern XRCORE_API EFS_Utils* xr_EFS;
45+
extern XRCORE_API std::unique_ptr<EFS_Utils> xr_EFS;
4646
#define EFS (*xr_EFS)
4747

4848
#endif /*_INCDEF_FileSystem_H_*/

src/xrCore/LocatorAPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
const u32 BIG_FILE_READER_WINDOW_SIZE = 1024 * 1024;
2121

22-
CLocatorAPI* xr_FS = nullptr;
22+
std::unique_ptr<CLocatorAPI> xr_FS;
2323

2424
#ifdef _EDITOR
2525
static constexpr pcstr FSLTX = "fs.ltx"

src/xrCore/LocatorAPI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,5 +212,5 @@ class XRCORE_API CLocatorAPI : Noncopyable
212212
void unlock_rescan();
213213
};
214214

215-
extern XRCORE_API CLocatorAPI* xr_FS;
215+
extern XRCORE_API std::unique_ptr<CLocatorAPI> xr_FS;
216216
#define FS (*xr_FS)

src/xrCore/xrCore.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ void xrCore::Initialize(pcstr _ApplicationName, LogCallback cb, bool init_fs, pc
8282

8383
rtc_initialize();
8484

85-
xr_FS = new CLocatorAPI();
85+
xr_FS = std::make_unique<CLocatorAPI>();
8686

87-
xr_EFS = new EFS_Utils();
87+
xr_EFS = std::make_unique<EFS_Utils>();
8888
//. R_ASSERT (co_res==S_OK);
8989
}
9090
if (init_fs)
@@ -135,8 +135,8 @@ void xrCore::_destroy()
135135
ttapi.destroy();
136136
FS._destroy();
137137
EFS._destroy();
138-
xr_delete(xr_FS);
139-
xr_delete(xr_EFS);
138+
xr_FS.reset();
139+
xr_EFS.reset();
140140

141141
#ifndef _EDITOR
142142
if (trained_model)

0 commit comments

Comments
 (0)