Kill some commented out code and other cleanups (#649)

diff --git a/src/OpenSSL/SSL.py b/src/OpenSSL/SSL.py
index b17d25b..9ac9651 100644
--- a/src/OpenSSL/SSL.py
+++ b/src/OpenSSL/SSL.py
@@ -652,10 +652,6 @@
         self._ocsp_callback = None
         self._ocsp_data = None
 
-        # SSL_CTX_set_app_data(self->ctx, self);
-        # SSL_CTX_set_mode(self->ctx, SSL_MODE_ENABLE_PARTIAL_WRITE |
-        #                             SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER |
-        #                             SSL_MODE_AUTO_RETRY);
         self.set_mode(_lib.SSL_MODE_ENABLE_PARTIAL_WRITE)
 
     def load_verify_locations(self, cafile, capath=None):
@@ -912,7 +908,6 @@
             _text_to_bytes_and_warn("cafile", cafile)
         )
         _openssl_assert(ca_list != _ffi.NULL)
-        # SSL_CTX_set_client_CA_list doesn't return anything.
         _lib.SSL_CTX_set_client_CA_list(self._context, ca_list)
 
     def set_session_id(self, buf):
@@ -1269,8 +1264,7 @@
         # Build a C string from the list. We don't need to save this off
         # because OpenSSL immediately copies the data out.
         input_str = _ffi.new("unsigned char[]", protostr)
-        input_str_len = _ffi.cast("unsigned", len(protostr))
-        _lib.SSL_CTX_set_alpn_protos(self._context, input_str, input_str_len)
+        _lib.SSL_CTX_set_alpn_protos(self._context, input_str, len(protostr))
 
     @_requires_alpn
     def set_alpn_select_callback(self, callback):
@@ -2204,8 +2198,7 @@
         # Build a C string from the list. We don't need to save this off
         # because OpenSSL immediately copies the data out.
         input_str = _ffi.new("unsigned char[]", protostr)
-        input_str_len = _ffi.cast("unsigned", len(protostr))
-        _lib.SSL_set_alpn_protos(self._ssl, input_str, input_str_len)
+        _lib.SSL_set_alpn_protos(self._ssl, input_str, len(protostr))
 
     @_requires_alpn
     def get_alpn_proto_negotiated(self):
diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py
index 5803ae9..e58a455 100644
--- a/src/OpenSSL/crypto.py
+++ b/src/OpenSSL/crypto.py
@@ -739,23 +739,9 @@
     }
 
     def _subjectAltNameString(self):
-        method = _lib.X509V3_EXT_get(self._extension)
-        _openssl_assert(method != _ffi.NULL)
-        ext_data = _lib.X509_EXTENSION_get_data(self._extension)
-        payload = ext_data.data
-        length = ext_data.length
-
-        payloadptr = _ffi.new("unsigned char**")
-        payloadptr[0] = payload
-
-        if method.it != _ffi.NULL:
-            ptr = _lib.ASN1_ITEM_ptr(method.it)
-            data = _lib.ASN1_item_d2i(_ffi.NULL, payloadptr, length, ptr)
-            names = _ffi.cast("GENERAL_NAMES*", data)
-        else:
-            names = _ffi.cast(
-                "GENERAL_NAMES*",
-                method.d2i(_ffi.NULL, payloadptr, length))
+        names = _ffi.cast(
+            "GENERAL_NAMES*", _lib.X509V3_EXT_d2i(self._extension)
+        )
 
         names = _ffi.gc(names, _lib.GENERAL_NAMES_free)
         parts = []