Skip to content

Commit bd08afb

Browse files
committed
Fix "bugs"
1 parent 1fa442b commit bd08afb

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

src/objects/config.cxx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,10 @@ ghc::filesystem::path Config::link_write(std::string &data_product){
350350

351351
if(config_writes_().IsSequence()){
352352
for (YAML::const_iterator it = config_writes_().begin(); it != config_writes_().end(); ++it) {
353-
YAML::Node write_ = *it;
354-
355-
if(write_["data_product"]){
356-
if(write_["data_product"].as<std::string>() == data_product)
353+
if(it->as<YAML::Node>()["data_product"]){
354+
if(it->as<YAML::Node>()["data_product"].as<std::string>() == data_product)
357355
{
358-
currentWrite = write_;
356+
currentWrite = it->as<YAML::Node>();
359357
}
360358
}
361359

@@ -427,12 +425,10 @@ ghc::filesystem::path FDP::Config::link_read(std::string &data_product){
427425

428426
if(config_reads_().IsSequence()){
429427
for (YAML::const_iterator it = config_reads_().begin(); it != config_reads_().end(); ++it) {
430-
YAML::Node read_ = *it;
431-
432-
if(read_["data_product"]){
433-
if(read_["data_product"].as<std::string>() == data_product)
428+
if(it->as<YAML::Node>()["data_product"]){
429+
if(it->as<YAML::Node>()["data_product"].as<std::string>() == data_product)
434430
{
435-
currentRead = read_;
431+
currentRead = it->as<YAML::Node>();
436432
}
437433
}
438434

src/registry/data_io.cxx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ double read_point_estimate_from_toml(const ghc::filesystem::path var_address) {
3636
}
3737

3838
std::string get_first_key_(const toml::value data_table) {
39-
for (auto const& i : data_table.as_table()) {
40-
return i.first;
41-
}
42-
43-
return "";
39+
return data_table.as_table().begin()->first;
4440
}
4541
}; // namespace FDP

0 commit comments

Comments
 (0)