From e28f4ed7e2ad1a97623ec802d1b179c0c703c7f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 30 Apr 2020 15:18:27 +0200 Subject: [PATCH] [apps/code/variable_box_controller] Use std::min --- apps/code/variable_box_controller.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/code/variable_box_controller.cpp b/apps/code/variable_box_controller.cpp index 1602b4c27..ec31fbae1 100644 --- a/apps/code/variable_box_controller.cpp +++ b/apps/code/variable_box_controller.cpp @@ -9,6 +9,7 @@ #include #include #include +#include extern "C" { #include "py/lexer.h" @@ -18,8 +19,6 @@ extern "C" { namespace Code { -static inline int minInt(int x, int y) { return x < y ? x : y; } - // Got these in python/py/src/compile.cpp compiled file constexpr static uint PN_file_input_2 = 1; constexpr static uint PN_funcdef = 3; @@ -256,7 +255,7 @@ int VariableBoxController::NodeNameCompare(ScriptNode * node, const char * name, assert(nameLength > 0); const char * nodeName = node->name(); const int nodeNameLength = node->nameLength() < 0 ? strlen(nodeName) : node->nameLength(); - const int comparisonLength = minInt(nameLength, nodeNameLength); + const int comparisonLength = std::min(nameLength, nodeNameLength); int result = strncmp(nodeName, name, comparisonLength); if (result != 0) { return result; @@ -377,7 +376,7 @@ bool VariableBoxController::selectLeaf(int rowIndex) { void VariableBoxController::insertTextInCaller(const char * text, int textLength) { int textLen = textLength < 0 ? strlen(text) : textLength; - int commandBufferMaxSize = minInt(k_maxScriptObjectNameSize, textLen + 1); + int commandBufferMaxSize = std::min(k_maxScriptObjectNameSize, textLen + 1); char commandBuffer[k_maxScriptObjectNameSize]; Shared::ToolboxHelpers::TextToInsertForCommandText(text, textLen, commandBuffer, commandBufferMaxSize, true); sender()->handleEventWithText(commandBuffer);