Skip to content

Commit

Permalink
Rename merge() -> merge_internal()
Browse files Browse the repository at this point in the history
Having the same name as the public function provoked errors due to
conversion from nlohmann::json types.
  • Loading branch information
franzpoeschel committed Feb 10, 2025
1 parent 017a54f commit 07a0ac2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/openPMD/auxiliary/JSON_internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ namespace json
* Like merge() as defined in JSON.hpp, but this overload works directly
* on nlohmann::json values.
*/
nlohmann::json &merge(
nlohmann::json &merge_internal(
nlohmann::json &defaultVal,
nlohmann::json const &overwrite,
bool do_prune);
Expand Down
4 changes: 2 additions & 2 deletions src/IO/HDF5/HDF5IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ HDF5IOHandlerImpl::HDF5IOHandlerImpl(
json::filterByTemplate(
m_global_flush_config, nlohmann::json::parse(flush_cfg_mask));
auto init_json_shadow = nlohmann::json::parse(init_json_shadow_str);
json::merge(
json::merge_internal(
m_config.getShadow(), init_json_shadow, /* do_prune = */ false);
}

Expand Down Expand Up @@ -511,7 +511,7 @@ void HDF5IOHandlerImpl::createDataset(
hdf5_config_it != parsed_config.config.end())
{
auto copy = m_global_dataset_config;
json::merge(
json::merge_internal(
copy, hdf5_config_it.value(), /* do_prune = */ true);
hdf5_config_it.value() = std::move(copy);
}
Expand Down
2 changes: 1 addition & 1 deletion src/IO/HDF5/ParallelHDF5IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ParallelHDF5IOHandler::flush(internal::ParsedFlushParams &params)
hdf5_config_it != params.backendConfig.json().end())
{
auto copied_global_cfg = m_impl->m_global_flush_config;
json::merge(
json::merge_internal(
copied_global_cfg, hdf5_config_it.value(), /* do_prune = */ true);
hdf5_config_it.value() = std::move(copied_global_cfg);
}
Expand Down
2 changes: 1 addition & 1 deletion src/IO/IOTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ json::ParsedConfig Parameter<Operation::CREATE_DATASET>::compileJSONConfig(
auto base_config = jsonMatcher.get(path);
auto manual_config =
json::parseOptions(options, /* considerFiles = */ false);
json::merge(
json::merge_internal(
base_config.config, manual_config.config, /* do_prune = */ true);
return json::ParsedConfig{
std::move(base_config.config),
Expand Down
6 changes: 3 additions & 3 deletions src/auxiliary/JSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ void warnGlobalUnusedOptions(TracingJSON const &config)
}
}

nlohmann::json &merge(
nlohmann::json &merge_internal(
nlohmann::json &defaultVal, nlohmann::json const &overwrite, bool do_prune)
{
if (defaultVal.is_object() && overwrite.is_object())
Expand All @@ -592,7 +592,7 @@ nlohmann::json &merge(
for (auto it = overwrite.begin(); it != overwrite.end(); ++it)
{
auto &valueInDefault = defaultVal[it.key()];
merge(valueInDefault, it.value(), do_prune);
merge_internal(valueInDefault, it.value(), do_prune);
if (do_prune && valueInDefault.is_null())
{
prunedKeys.push(it.key());
Expand Down Expand Up @@ -638,7 +638,7 @@ std::string merge_impl(
overwrite,
std::forward<MPI_Comm_t>(comm)...,
/* considerFiles = */ true);
merge(res, second, /* do_prune = */ true);
merge_internal(res, second, /* do_prune = */ true);
switch (returnFormat)
{
case SupportedLanguages::JSON:
Expand Down

0 comments on commit 07a0ac2

Please sign in to comment.