Skip to content

Commit 0bae7f6

Browse files
committed
Change maps to switch
1 parent 3cc3b70 commit 0bae7f6

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/aws-cpp-sdk-core/source/auth/signer/AWSAuthV4Signer.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -631,20 +631,22 @@ void AWSAuthV4Signer::UpdateUserAgentWithCredentialFeatures(Aws::Http::HttpReque
631631
Aws::StringStream credentialMetrics;
632632
bool firstFeature = true;
633633

634-
static const std::map<Aws::Client::UserAgentFeature, char> featureMap = {
635-
{Aws::Client::UserAgentFeature::CREDENTIALS_ENV_VARS, 'g'},
636-
// Add other credential mappings as needed
637-
};
638-
639634
for (const auto& feature : features) {
640-
auto it = featureMap.find(feature);
641-
if (it != featureMap.end()) {
642-
if (!firstFeature) {
643-
credentialMetrics << ",";
644-
}
645-
credentialMetrics << it->second;
646-
firstFeature = false;
635+
char featureChar = 0;
636+
switch (feature) {
637+
case Aws::Client::UserAgentFeature::CREDENTIALS_ENV_VARS:
638+
featureChar = 'g';
639+
break;
640+
// Add other credential feature mappings as needed
641+
default:
642+
continue; // Skip non-credential features
643+
}
644+
645+
if (!firstFeature) {
646+
credentialMetrics << ",";
647647
}
648+
credentialMetrics << featureChar;
649+
firstFeature = false;
648650
}
649651

650652
if (credentialMetrics.str().empty()) {

0 commit comments

Comments
 (0)