adamdebreceni commented on a change in pull request #866:
URL: https://github.com/apache/nifi-minifi-cpp/pull/866#discussion_r468377461



##########
File path: extensions/libarchive/MergeContent.cpp
##########
@@ -271,6 +281,16 @@ bool MergeContent::processBin(core::ProcessContext 
*context, core::ProcessSessio
       return false;
     }
     session->putAttribute(mergeFlow, BinFiles::FRAGMENT_COUNT_ATTRIBUTE, 
std::to_string(bin->getSize()));
+
+    std::unique_ptr<AttributeMerger> attributeMerger;
+    if (attributeStrategy_ == ATTRIBUTE_STRATEGY_KEEP_COMMON)
+      attributeMerger = std::unique_ptr < AttributeMerger > (new 
KeepOnlyCommonAttributesMerger(session, bin->getFlowFile(), mergeFlow));

Review comment:
       I would keep it on the stack and immediately use it like 
`KeepOnlyCommonAttributesMerger(session, bin->getFlowFile(), 
mergeFlow).mergeAttributes()` it really is a single-use object (and we have to 
be careful to keep it that way as 
`KeepAllUniqueAttributesMerger::mergeAttributes` is not idempotent)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to