Since sockaddr_tipc has an union, a memcmp() is not enough for comparison,
because a currently unused chunk of memory could be different but the
addresses are conceptually the same.
bool posixx::linux::tipc::sockaddr::operator == (const sockaddr& other) const
throw ()
{
bool posixx::linux::tipc::sockaddr::operator == (const sockaddr& other) const
throw ()
{
- return !memcmp(this, &other, sizeof(*this));
+ if (family != other.family)
+ return false;
+ if (addrtype != other.addrtype)
+ return false;
+ if (scope != other.scope)
+ return false;
+ if (addrtype == ID)
+ return port_id() == other.port_id();
+ if (addrtype == NAME)
+ return name_domain() == other.name_domain()
+ && port_name() == other.port_name();
+ if (addrtype == NAMESEQ)
+ return name_seq() == other.name_seq();
+ return memcmp(this, &other, sizeof(*this)) == 0;