Cut debugging code from SocketAddress
authorYedidya Feldblum <yfeldblum@fb.com>
Tue, 1 Aug 2017 22:53:15 +0000 (15:53 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 1 Aug 2017 23:10:13 +0000 (16:10 -0700)
Summary:
[Folly] Cut debugging code from `SocketAddress`.

Specifically from its `ExternalUnixAddr` helper class, which is probably not broken.

Reviewed By: simpkins

Differential Revision: D5530685

fbshipit-source-id: adfc46ec1c1a142e9914051e8a97b39f41d71630

folly/SocketAddress.h

index 54fc6a36069471d0789fa8bcfd91ce1acaaec443..06c698839be0cea3654c41eeb39cdd1c7a3ffba5 100644 (file)
@@ -543,38 +543,26 @@ class SocketAddress {
     struct sockaddr_un *addr;
     socklen_t len;
 
-    /* For debugging only, will be removed */
-    uint64_t magic;
-    static constexpr uint64_t kMagic = 0x1234faceb00c;
-
     socklen_t pathLength() const {
       return socklen_t(len - offsetof(struct sockaddr_un, sun_path));
     }
 
     void init() {
-      addr = new sockaddr_un;
-      magic = kMagic;
+      addr = new struct sockaddr_un;
       addr->sun_family = AF_UNIX;
       len = 0;
     }
     void init(const ExternalUnixAddr &other) {
-      addr = new sockaddr_un;
-      magic = kMagic;
+      addr = new struct sockaddr_un;
       len = other.len;
       memcpy(addr, other.addr, size_t(len));
-      // Fill the rest with 0s, just for safety
-      memset(reinterpret_cast<char*>(addr) + len, 0,
-             sizeof(struct sockaddr_un) - len);
     }
     void copy(const ExternalUnixAddr &other) {
-      CHECK(magic == kMagic);
       len = other.len;
       memcpy(addr, other.addr, size_t(len));
     }
     void free() {
-      CHECK(magic == kMagic);
       delete addr;
-      magic = 0;
     }
   };