summaryrefslogtreecommitdiff
path: root/src/utils/smart_string.cpp
blob: 5258ffe86296c70510ee909fd69ac845abad4142 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "smart_string.hpp"

#include "memory.hpp"

#include <stdlib.h>

SmartString::SmartString(char *c_string)
{
	this->c_str = c_string;
}

SmartString::SmartString(unsigned int size)
{
	this->c_str = malloc_s<char>(size + 1);
}

SmartString::~SmartString()
{
	if (this->c_str != nullptr)
		free(this->c_str);
}

SmartString::operator char *() const
{
	return this->c_str;
}