diff --git a/edm4hep/schema_evolution/src/OldLinkEvolution.cc b/edm4hep/schema_evolution/src/OldLinkEvolution.cc index 630e74d0d..c15b64c08 100644 --- a/edm4hep/schema_evolution/src/OldLinkEvolution.cc +++ b/edm4hep/schema_evolution/src/OldLinkEvolution.cc @@ -31,40 +31,30 @@ namespace { /// of the templated links. The most important bit is the re-definition of /// createCollection to actually create a templated LinkCollection template - auto evolveLinks(podio::CollectionReadBuffers oldBuffers, podio::SchemaVersionT) { - podio::CollectionReadBuffers newBuffers{}; - newBuffers.type = podio::detail::linkCollTypeName(); - newBuffers.schemaVersion = podio::LinkCollection::schemaVersion; - - // We can simply copy over all the buffer pointers since they are already - // created correctly by the factory function - newBuffers.data = oldBuffers.data; - oldBuffers.data = nullptr; - newBuffers.references = oldBuffers.references; - oldBuffers.references = nullptr; - newBuffers.vectorMembers = oldBuffers.vectorMembers; - oldBuffers.vectorMembers = nullptr; - - newBuffers.createCollection = [](const podio::CollectionReadBuffers& buffers, bool isSubsetColl) { - podio::LinkCollectionData data(buffers, isSubsetColl); + auto evolveLinks(podio::CollectionReadBuffers buffers, podio::SchemaVersionT) { + buffers.type = podio::detail::linkCollTypeName(); + buffers.schemaVersion = podio::LinkCollection::schemaVersion; + + buffers.createCollection = [](const podio::CollectionReadBuffers& buffs, bool isSubsetColl) { + podio::LinkCollectionData data(buffs, isSubsetColl); return std::make_unique>(std::move(data), isSubsetColl); }; - newBuffers.recast = [](podio::CollectionReadBuffers& buffers) { - if (buffers.data) { - buffers.data = podio::CollectionWriteBuffers::asVector(buffers.data); + buffers.recast = [](podio::CollectionReadBuffers& buffs) { + if (buffs.data) { + buffs.data = podio::CollectionWriteBuffers::asVector(buffs.data); } }; - newBuffers.deleteBuffers = [](podio::CollectionReadBuffers& buffers) { - if (buffers.data) { - delete static_cast*>(buffers.data); + buffers.deleteBuffers = [](podio::CollectionReadBuffers& buffs) { + if (buffs.data) { + delete static_cast*>(buffs.data); } - delete buffers.references; - delete buffers.vectorMembers; + delete buffs.references; + delete buffs.vectorMembers; }; - return newBuffers; + return buffers; } /// Function factory for stamping out buffer creation functions that can be