aboutsummaryrefslogtreecommitdiff
path: root/backend/String.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-02 15:55:58 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-02 15:55:58 +0100
commit5e4dd0c0197f6273c61491a5b9a030c93f796a12 (patch)
tree390fc6d980cc49927523befb43d189c608452276 /backend/String.cpp
parent369e3d71aa79783d95166739cfa93a480defe6ea (diff)
add some tests
Diffstat (limited to 'backend/String.cpp')
-rw-r--r--backend/String.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/backend/String.cpp b/backend/String.cpp
index e5512bf..84dc2ec 100644
--- a/backend/String.cpp
+++ b/backend/String.cpp
@@ -26,7 +26,7 @@ String::String(String && other) {
}
String & String::operator = (String && other) {
if (this == &other) return *this;
- safe_free(this->_data);
+ safe_free(&this->_data);
this->_data = other._data;
this->_data_len = other._data_len;
other._data = nullptr;
@@ -58,14 +58,14 @@ String String::va_fmt(va_list args, const char * fmt) {
out._data_len = vsnprintf(NULL, 0, fmt, args_copy);
va_end(args_copy);
- safe_free(out._data);
+ safe_free(&out._data);
out._data = static_cast<char *>(malloc(out._data_len + 1));
vsnprintf(out._data, out._data_len + 1, fmt, args);
return out;
}
String::~String() {
- safe_free(this->_data);
+ safe_free(&this->_data);
}
void String::set(const char * data) {
@@ -73,7 +73,7 @@ void String::set(const char * data) {
}
void String::set(const char * data, size_t data_len) {
- safe_free(this->_data);
+ safe_free(&this->_data);
this->_data = static_cast<char *>(malloc(data_len + 1));
this->_data_len = data_len;
memcpy(this->_data, data, data_len);