1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

core: get rid of built-in String type

This commit is contained in:
Vladislav Sovrasov
2017-05-19 10:13:31 +03:00
committed by Alexander Alekhin
parent ee1e1ce377
commit ae8dcdf40d
8 changed files with 7 additions and 679 deletions
-24
View File
@@ -43,27 +43,3 @@
#include "precomp.hpp"
char* cv::String::allocate(size_t len)
{
size_t totalsize = alignSize(len + 1, (int)sizeof(int));
int* data = (int*)cv::fastMalloc(totalsize + sizeof(int));
data[0] = 1;
cstr_ = (char*)(data + 1);
len_ = len;
cstr_[len] = 0;
return cstr_;
}
void cv::String::deallocate()
{
int* data = (int*)cstr_;
len_ = 0;
cstr_ = 0;
if(data && 1 == CV_XADD(data-1, -1))
{
cv::fastFree(data-1);
}
}