From 7892ef9d248c189be68ce7faf63230ec0a318b67 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 14 Feb 2022 10:11:32 +0100 Subject: refactor: reorganize & add debugging --- src/utils/smart_string.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/utils/smart_string.cpp (limited to 'src/utils/smart_string.cpp') diff --git a/src/utils/smart_string.cpp b/src/utils/smart_string.cpp new file mode 100644 index 0000000..5258ffe --- /dev/null +++ b/src/utils/smart_string.cpp @@ -0,0 +1,26 @@ +#include "smart_string.hpp" + +#include "memory.hpp" + +#include + +SmartString::SmartString(char *c_string) +{ + this->c_str = c_string; +} + +SmartString::SmartString(unsigned int size) +{ + this->c_str = malloc_s(size + 1); +} + +SmartString::~SmartString() +{ + if (this->c_str != nullptr) + free(this->c_str); +} + +SmartString::operator char *() const +{ + return this->c_str; +} -- cgit v1.2.3-18-g5258