Skip to content

Commit

Permalink
Use unique_ptr for FS and EFS ptr.
Browse files Browse the repository at this point in the history
  • Loading branch information
intorr committed Mar 17, 2018
1 parent 243c7c7 commit bd50031
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/xrCore/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "commdlg.h"
#include "vfw.h"

EFS_Utils* xr_EFS = NULL;
std::unique_ptr<EFS_Utils> xr_EFS;
//----------------------------------------------------
EFS_Utils::EFS_Utils() {}
EFS_Utils::~EFS_Utils() {}
Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class XRCORE_API EFS_Utils
static xr_string ExtractFileExt(LPCSTR src);
static xr_string ExcludeBasePath(LPCSTR full_path, LPCSTR excl_path);
};
extern XRCORE_API EFS_Utils* xr_EFS;
extern XRCORE_API std::unique_ptr<EFS_Utils> xr_EFS;
#define EFS (*xr_EFS)

#endif /*_INCDEF_FileSystem_H_*/
2 changes: 1 addition & 1 deletion src/xrCore/LocatorAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

const u32 BIG_FILE_READER_WINDOW_SIZE = 1024 * 1024;

CLocatorAPI* xr_FS = nullptr;
std::unique_ptr<CLocatorAPI> xr_FS;

#ifdef _EDITOR
static constexpr pcstr FSLTX = "fs.ltx"
Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/LocatorAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,5 @@ class XRCORE_API CLocatorAPI : Noncopyable
void unlock_rescan();
};

extern XRCORE_API CLocatorAPI* xr_FS;
extern XRCORE_API std::unique_ptr<CLocatorAPI> xr_FS;
#define FS (*xr_FS)
8 changes: 4 additions & 4 deletions src/xrCore/xrCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ void xrCore::Initialize(pcstr _ApplicationName, LogCallback cb, bool init_fs, pc

rtc_initialize();

xr_FS = new CLocatorAPI();
xr_FS = std::make_unique<CLocatorAPI>();

xr_EFS = new EFS_Utils();
xr_EFS = std::make_unique<EFS_Utils>();
//. R_ASSERT (co_res==S_OK);
}
if (init_fs)
Expand Down Expand Up @@ -135,8 +135,8 @@ void xrCore::_destroy()
ttapi.destroy();
FS._destroy();
EFS._destroy();
xr_delete(xr_FS);
xr_delete(xr_EFS);
xr_FS.reset();
xr_EFS.reset();

#ifndef _EDITOR
if (trained_model)
Expand Down

0 comments on commit bd50031

Please sign in to comment.