1 | // |
---|---|
2 | // HTTPBufferAllocator.cpp |
3 | // |
4 | // Library: Net |
5 | // Package: HTTP |
6 | // Module: HTTPBufferAllocator |
7 | // |
8 | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. |
9 | // and Contributors. |
10 | // |
11 | // SPDX-License-Identifier: BSL-1.0 |
12 | // |
13 | |
14 | |
15 | #include "Poco/Net/HTTPBufferAllocator.h" |
16 | |
17 | |
18 | using Poco::MemoryPool; |
19 | |
20 | |
21 | namespace Poco { |
22 | namespace Net { |
23 | |
24 | |
25 | MemoryPool HTTPBufferAllocator::_pool(HTTPBufferAllocator::BUFFER_SIZE, 16); |
26 | |
27 | |
28 | char* HTTPBufferAllocator::allocate(std::streamsize size) |
29 | { |
30 | poco_assert_dbg (size == BUFFER_SIZE); |
31 | |
32 | return reinterpret_cast<char*>(_pool.get()); |
33 | } |
34 | |
35 | |
36 | void HTTPBufferAllocator::deallocate(char* ptr, std::streamsize size) |
37 | { |
38 | poco_assert_dbg (size == BUFFER_SIZE); |
39 | |
40 | _pool.release(ptr); |
41 | } |
42 | |
43 | |
44 | } } // namespace Poco::Net |
45 |