Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Take advantage of emplace

Co-authored-by: René Meusel <[email protected]>
  • Loading branch information
randombit and reneme committed Apr 9, 2024
1 parent a945acc commit 4791288
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/lib/x509/asn1_alt_name.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ void AlternativeName::add_othername(const OID& oid, std::string_view value, ASN1
if(value.empty()) {
return;
}
ASN1_String str(value, type);
m_othernames.insert(std::make_pair(oid, str));
m_othernames.emplace(oid, ASN1_String{value, type});
}

/*
Expand All @@ -71,9 +70,7 @@ std::multimap<std::string, std::string> AlternativeName::contents() const {
}

for(const auto& othername : m_othernames) {
std::string typ = othername.first.to_formatted_string();
std::string value = othername.second.value();
names.insert(std::make_pair(typ, value));
names.emplace(othername.first.to_formatted_string(), othername.second.value());
}

return names;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/x509/x509_dn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ std::multimap<OID, std::string> X509_DN::get_attributes() const {
std::multimap<OID, std::string> retval;

for(auto& i : m_rdn) {
retval.insert(std::make_pair(i.first, i.second.value()));
retval.emplace(i.first, i.second.value());
}
return retval;
}
Expand All @@ -125,7 +125,7 @@ std::multimap<std::string, std::string> X509_DN::contents() const {
std::multimap<std::string, std::string> retval;

for(auto& i : m_rdn) {
retval.insert(std::make_pair(i.first.to_formatted_string(), i.second.value()));
retval.emplace(i.first.to_formatted_string(), i.second.value());
}
return retval;
}
Expand Down

0 comments on commit 4791288

Please sign in to comment.