aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/utils/MemoryUtils.h
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2023-12-13 10:01:06 +0000
committersaturneric <[email protected]>2023-12-13 10:01:06 +0000
commit42264ed0d7a3c91fbe9f307984964ffc9e5fe65c (patch)
treea3ddecbd6ad723e42d68cc2c5aed7a88c4e242a3 /src/core/utils/MemoryUtils.h
parentfeat: move test to src and add submodule googletest (diff)
downloadGpgFrontend-42264ed0d7a3c91fbe9f307984964ffc9e5fe65c.tar.gz
GpgFrontend-42264ed0d7a3c91fbe9f307984964ffc9e5fe65c.zip
refactor: improve the structure of main,core and test module
Diffstat (limited to 'src/core/utils/MemoryUtils.h')
-rw-r--r--src/core/utils/MemoryUtils.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/utils/MemoryUtils.h b/src/core/utils/MemoryUtils.h
index 4f92b5e9..5261a958 100644
--- a/src/core/utils/MemoryUtils.h
+++ b/src/core/utils/MemoryUtils.h
@@ -112,7 +112,8 @@ template <typename T, typename... Args>
static auto SecureCreateObject(Args &&...args) -> T * {
void *mem = SecurityMemoryAllocator::Allocate(sizeof(T));
if (!mem) return nullptr;
- SPDLOG_TRACE("alloc secure memnory success, mem: {}", static_cast<void *>(mem));
+ SPDLOG_TRACE("alloc secure memnory success, mem: {}",
+ static_cast<void *>(mem));
try {
return new (mem) T(std::forward<Args>(args)...);
@@ -136,7 +137,8 @@ static auto SecureCreateUniqueObject(Args &&...args)
-> std::unique_ptr<T, SecureObjectDeleter<T>> {
void *mem = SecurityMemoryAllocator::Allocate(sizeof(T));
if (!mem) throw std::bad_alloc();
- SPDLOG_TRACE("alloc secure memnory success, unique, mem: {}", mem);
+ SPDLOG_TRACE("alloc secure memnory success, unique ptr, type: {}, mem: {}",
+ typeid(T).name(), mem);
try {
return std::unique_ptr<T, SecureObjectDeleter<T>>(
@@ -151,7 +153,8 @@ template <typename T, typename... Args>
auto SecureCreateSharedObject(Args &&...args) -> std::shared_ptr<T> {
void *mem = SecurityMemoryAllocator::Allocate(sizeof(T));
if (!mem) throw std::bad_alloc();
- SPDLOG_TRACE("alloc secure memnory success, shared, mem: {}", mem);
+ SPDLOG_TRACE("alloc secure memnory success, shared ptr, type: {}, mem: {}",
+ typeid(T).name(), mem);
try {
T *obj = new (mem) T(std::forward<Args>(args)...);