]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: remove last goto in libsslsquid
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 7 Mar 2016 16:03:45 +0000 (05:03 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 7 Mar 2016 16:03:45 +0000 (05:03 +1300)
src/ssl/support.cc

index a978fc329e1fafc252e28a0c755d21bbfd38d27e..611c412d33063e41014b46f92669d1339be29e34 100644 (file)
@@ -743,26 +743,20 @@ static const char *
 ssl_get_attribute(X509_NAME * name, const char *attribute_name)
 {
     static char buffer[1024];
-    int nid;
-
     buffer[0] = '\0';
 
     if (strcmp(attribute_name, "DN") == 0) {
         X509_NAME_oneline(name, buffer, sizeof(buffer));
-        goto done;
-    }
-
-    nid = OBJ_txt2nid((char *) attribute_name);
-
-    if (nid == 0) {
-        debugs(83, DBG_IMPORTANT, "WARNING: Unknown SSL attribute name '" << attribute_name << "'");
-        return NULL;
+    } else {
+        int nid = OBJ_txt2nid(const_cast<char *>(attribute_name));
+        if (nid == 0) {
+            debugs(83, DBG_IMPORTANT, "WARNING: Unknown SSL attribute name '" << attribute_name << "'");
+            return nullptr;
+        }
+        X509_NAME_get_text_by_NID(name, nid, buffer, sizeof(buffer));
     }
 
-    X509_NAME_get_text_by_NID(name, nid, buffer, sizeof(buffer));
-
-done:
-    return *buffer ? buffer : NULL;
+    return *buffer ? buffer : nullptr;
 }
 
 /// \ingroup ServerProtocolSSLInternal