mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-27 01:14:44 +01:00
removed Var iterators, fixed SOO alignment
- removed unnecessary using directives in Data library - removed iterator pointers from Var (reduce size, always return copy) - added Alignment header (adapted from LLVM infrastructure) - added alignment guards to SOO implementations
This commit is contained in:
@@ -44,6 +44,11 @@
|
||||
#include "Poco/Net/SocketDefs.h"
|
||||
#include "Poco/Net/IPAddressImpl.h"
|
||||
#include <vector>
|
||||
#ifdef POCO_ENABLE_CPP11
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include "Poco/Alignment.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -387,9 +392,23 @@ private:
|
||||
typedef Impl* Ptr;
|
||||
|
||||
Ptr pImpl() const;
|
||||
|
||||
void destruct();
|
||||
|
||||
char _memory[sizeof(Poco::Net::Impl::IPv6AddressImpl)];
|
||||
char* storage();
|
||||
|
||||
#ifdef POCO_ENABLE_CPP11
|
||||
static const unsigned sz = sizeof(Poco::Net::Impl::IPv6AddressImpl);
|
||||
union
|
||||
{
|
||||
std::aligned_storage<sz> a;
|
||||
char buffer[sz];
|
||||
}
|
||||
#else // !POCO_ENABLE_CPP11
|
||||
AlignedCharArrayUnion <Poco::Net::Impl::IPv6AddressImpl,
|
||||
Poco::Net::Impl::IPv4AddressImpl>
|
||||
#endif // POCO_ENABLE_CPP11
|
||||
_memory;
|
||||
};
|
||||
|
||||
|
||||
@@ -401,7 +420,13 @@ inline void IPAddress::destruct()
|
||||
|
||||
inline IPAddress::Ptr IPAddress::pImpl() const
|
||||
{
|
||||
return reinterpret_cast<Ptr>(const_cast<char *>(_memory));
|
||||
return reinterpret_cast<Ptr>(const_cast<char *>(_memory.buffer));
|
||||
}
|
||||
|
||||
|
||||
inline char* IPAddress::storage()
|
||||
{
|
||||
return _memory.buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -153,9 +153,23 @@ private:
|
||||
typedef Impl* Ptr;
|
||||
|
||||
Ptr pImpl() const;
|
||||
|
||||
void destruct();
|
||||
|
||||
char _memory[sizeof(Poco::Net::Impl::IPv6SocketAddressImpl)];
|
||||
char* storage();
|
||||
|
||||
#ifdef POCO_ENABLE_CPP11
|
||||
static const unsigned sz = sizeof(Poco::Net::Impl::IPv6SocketAddressImpl);
|
||||
union
|
||||
{
|
||||
std::aligned_storage<sz> a;
|
||||
char buffer[sz];
|
||||
}
|
||||
#else // !POCO_ENABLE_CPP11
|
||||
AlignedCharArrayUnion <Poco::Net::Impl::IPv6SocketAddressImpl,
|
||||
Poco::Net::Impl::IPv4SocketAddressImpl>
|
||||
#endif // POCO_ENABLE_CPP11
|
||||
_memory;
|
||||
};
|
||||
|
||||
|
||||
@@ -172,7 +186,13 @@ inline void SocketAddress::destruct()
|
||||
|
||||
inline SocketAddress::Ptr SocketAddress::pImpl() const
|
||||
{
|
||||
return reinterpret_cast<Ptr>(const_cast<char *>(_memory));
|
||||
return reinterpret_cast<Ptr>(const_cast<char *>(_memory.buffer));
|
||||
}
|
||||
|
||||
|
||||
inline char* SocketAddress::storage()
|
||||
{
|
||||
return _memory.buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user