diff --git a/src/common/str.cpp b/src/common/str.cpp index dfe90c9c..a08ec777 100644 --- a/src/common/str.cpp +++ b/src/common/str.cpp @@ -23,7 +23,7 @@ int utf8len(unsigned char c, bool suppress){ if(this->size < (int)sizeof(this->_inlined)){ \ this->data = this->_inlined; \ }else{ \ - this->data = (char*)pool128_alloc(this->size+1); \ + this->data = (char*)std::malloc(this->size+1); \ } #define PK_STR_COPY_INIT(__s) \ @@ -103,7 +103,7 @@ int utf8len(unsigned char c, bool suppress){ } Str& Str::operator=(const Str& other){ - if(!is_inlined()) pool128_dealloc(data); + if(!is_inlined()) std::free(data); size = other.size; is_ascii = other.is_ascii; PK_STR_ALLOCATE() @@ -174,7 +174,7 @@ int utf8len(unsigned char c, bool suppress){ } Str::~Str(){ - if(!is_inlined()) pool128_dealloc(data); + if(!is_inlined()) std::free(data); } Str Str::substr(int start, int len) const { @@ -410,14 +410,10 @@ int utf8len(unsigned char c, bool suppress){ } Str SStream::str(){ -#if 0 // after this call, the buffer is no longer valid buffer.reserve(buffer.size() + 1); // allocate one more byte for '\0' buffer[buffer.size()] = '\0'; // set '\0' return Str(buffer.detach()); -#else - return Str(buffer.data(), buffer.size()); -#endif } SStream& SStream::operator<<(const Str& s){ diff --git a/src/compiler/compiler.cpp b/src/compiler/compiler.cpp index f2dddbe5..bf4b2ee8 100644 --- a/src/compiler/compiler.cpp +++ b/src/compiler/compiler.cpp @@ -1396,7 +1396,7 @@ __EAT_DOTS_END: Str TokenDeserializer::read_string_from_hex(char c){ std::string_view s = read_string(c); - char* buffer = (char*)pool128_alloc(s.size()/2 + 1); + char* buffer = (char*)std::malloc(s.size()/2 + 1); for(int i=0; i='0' && s[i]<='9') c += s[i]-'0';