simplify various code using new map index rule

R=r
CC=golang-dev
https://golang.org/cl/833044
This commit is contained in:
Russ Cox 2010-03-30 10:51:11 -07:00
parent c2e73307b5
commit d821ad088a

View File

@ -29,18 +29,10 @@ func nameToKey(name *x509.Name) string {
// FindParent attempts to find the certificate in s which signs the given
// certificate. If no such certificate can be found, it returns nil.
func (s *CASet) FindParent(cert *x509.Certificate) (parent *x509.Certificate) {
var ok bool
if len(cert.AuthorityKeyId) > 0 {
parent, ok = s.bySubjectKeyId[string(cert.AuthorityKeyId)]
} else {
parent, ok = s.byName[nameToKey(&cert.Issuer)]
return s.bySubjectKeyId[string(cert.AuthorityKeyId)]
}
if !ok {
return nil
}
return parent
return s.byName[nameToKey(&cert.Issuer)]
}
// SetFromPEM attempts to parse a series of PEM encoded root certificates. It