Skip to content

Commit

Permalink
alignment should be void*
Browse files Browse the repository at this point in the history
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
  • Loading branch information
lizan committed Aug 19, 2019
1 parent eed5eaa commit 910c9d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/common/network/socket_option_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class SocketOptionImpl : public Socket::Option, Logger::Loggable<Logger::Id::con
SocketOptionImpl(envoy::api::v2::core::SocketOption::SocketState in_state,
Network::SocketOptionName optname, absl::string_view value)
: in_state_(in_state), optname_(optname), value_(value.begin(), value.end()) {
ASSERT(reinterpret_cast<uintptr_t>(value_.data()) % alignof(std::max_align_t) == 0);
ASSERT(reinterpret_cast<uintptr_t>(value_.data()) % alignof(void*) == 0);
}

// Socket::Option
Expand Down Expand Up @@ -138,7 +138,7 @@ class SocketOptionImpl : public Socket::Option, Logger::Loggable<Logger::Id::con
const envoy::api::v2::core::SocketOption::SocketState in_state_;
const Network::SocketOptionName optname_;
// This has to be a std::vector<uint8_t> but not std::string because std::string might inline
// the buffer so its data() is not aligned in to alignof(std::max_align_t).
// the buffer so its data() is not aligned in to alignof(void*).
const std::vector<uint8_t> value_;
};

Expand Down

0 comments on commit 910c9d7

Please sign in to comment.