aboutsummaryrefslogtreecommitdiff
path: root/backend/util.cpp
blob: 4a55f634ca9e05c46599911f09284c6c74569c76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdlib.h>

#include "util.h"

void safe_free(void * & ptr) {
	if (ptr == nullptr) return;
	free(ptr);
	ptr = nullptr;
}
void safe_free(const char * & ptr) {
	auto x = static_cast<void *>(const_cast<char *>(ptr));
	safe_free(x);
}