Skip to content

Commit

Permalink
Assign to a const char* when using std::getenv
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Sep 18, 2024
1 parent 9b69494 commit b34198f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion k4FWCore/components/PodioOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ StatusCode PodioOutput::finalize() {
// Collect all the metadata
podio::Frame config_metadata_frame{};
config_metadata_frame.putParameter("gaudiConfigOptions", config_data);
if (const char* env_key4hep_stack = std::getenv("KEY4HEP_STACK")) {
if (const auto* env_key4hep_stack = std::getenv("KEY4HEP_STACK")) {
std::string s_env_key4hep_stack = env_key4hep_stack;
config_metadata_frame.putParameter("key4hepstack", s_env_key4hep_stack);
}
Expand Down
2 changes: 1 addition & 1 deletion k4FWCore/components/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class Writer final : public Gaudi::Functional::Consumer<void(const EventContext&
}

config_metadata_frame.putParameter("gaudiConfigOptions", config_data);
if (auto env_key4hep_stack = std::getenv("KEY4HEP_STACK")) {
if (const auto* env_key4hep_stack = std::getenv("KEY4HEP_STACK")) {
config_metadata_frame.putParameter("key4hepstack", env_key4hep_stack);
}
iosvc->getWriter()->writeFrame(config_metadata_frame, "configuration_metadata");
Expand Down

0 comments on commit b34198f

Please sign in to comment.