szaszm commented on code in PR #1915:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1915#discussion_r2042273666


##########
libminifi/src/core/yaml/YamlFlowSerializer.cpp:
##########
@@ -72,7 +62,19 @@ void 
YamlFlowSerializer::addProviderCreatedParameterContexts(YAML::Node flow_def
     }
 
     parameter_context_node[schema.parameters[0]] = parameters_node;
-    parameter_contexts_node.push_back(parameter_context_node);
+
+    int64_t index = -1;
+    for (int64_t i = 0; i < 
gsl::narrow<int64_t>(parameter_contexts_node.size()); ++i) {
+      if (parameter_contexts_node[i][schema.name[0]].as<std::string>() == 
parameter_context->getName()) {
+        index = i;
+        break;
+      }
+    }

Review Comment:
   Please prefer algorithms over raw loops where applicable. This looks like a 
find_if to me.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to