Loading src/connection.h +7 −14 Changes for src/connection.h: 7 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -95,8 +95,13 @@ namespace netplus { // allocate but don't initialize num elements of type T pointer allocate (size_type num, const void* = 0) { pointer ret = (pointer)(::operator new(num*sizeof(T))); return ret; if (num == 0) return nullptr; T* ptr = (T*)malloc(num * sizeof(T)); if (ptr == nullptr) throw std::bad_alloc(); return ptr; } // initialize elements of allocated storage p with value value Loading @@ -109,18 +114,6 @@ namespace netplus { p->~T(); } T* allocate(size_t num) { if (num == 0) return nullptr; T* ptr = (T*)malloc(num * sizeof(T)); if (ptr == nullptr) { throw std::bad_alloc(); } return ptr; } // deallocate storage p of deleted elements void deallocate (pointer p, size_type num) { ::operator delete((void*)p); Loading Loading
src/connection.h +7 −14 Changes for src/connection.h: 7 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -95,8 +95,13 @@ namespace netplus { // allocate but don't initialize num elements of type T pointer allocate (size_type num, const void* = 0) { pointer ret = (pointer)(::operator new(num*sizeof(T))); return ret; if (num == 0) return nullptr; T* ptr = (T*)malloc(num * sizeof(T)); if (ptr == nullptr) throw std::bad_alloc(); return ptr; } // initialize elements of allocated storage p with value value Loading @@ -109,18 +114,6 @@ namespace netplus { p->~T(); } T* allocate(size_t num) { if (num == 0) return nullptr; T* ptr = (T*)malloc(num * sizeof(T)); if (ptr == nullptr) { throw std::bad_alloc(); } return ptr; } // deallocate storage p of deleted elements void deallocate (pointer p, size_type num) { ::operator delete((void*)p); Loading