Eliminate a string allocation in folly::SocketAddr and bug in char[] conversion
authorChip Turner <chip@fb.com>
Tue, 6 Sep 2016 18:27:41 +0000 (11:27 -0700)
committerFacebook Github Bot 9 <facebook-github-bot-9-bot@fb.com>
Tue, 6 Sep 2016 18:38:28 +0000 (11:38 -0700)
commite64edf8025220bf74a2c38b8d38bd3a1d0a1e9eb
treeea69e9658ec9968cd62f8ca33f0e808b0b2770d6
parentbf77be6e78f97bba00f29c75baa6d9cfaccefb7b
Eliminate a string allocation in folly::SocketAddr and bug in char[] conversion

Summary:
We were doing an unnecessary and wasteful string conversion in the
SocketAddr codepath.  This eliminates it.  I also noticed we had an off-by-one
in the "convert string to char buffer" code path, so I added a test to confirm
the bug and fixed it.

Reviewed By: yfeldblum, meyering

Differential Revision: D3817959

fbshipit-source-id: 51fed8331ab23c0888a3d1f9e0cc9cea5ea8329b
folly/SocketAddress.cpp
folly/test/SocketAddressTest.cpp