From 7f037334bf239bcf940849b76a08ba4e98e7c69a Mon Sep 17 00:00:00 2001 From: James Cherry Date: Mon, 6 Jul 2020 18:35:36 -0700 Subject: [PATCH] compiler warning --- liberty/LibertyExpr.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/liberty/LibertyExpr.cc b/liberty/LibertyExpr.cc index 60ce4f55..4933cad9 100644 --- a/liberty/LibertyExpr.cc +++ b/liberty/LibertyExpr.cc @@ -16,6 +16,7 @@ #include "FuncExpr.hh" +#include // min #include "Report.hh" #include "StringUtil.hh" #include "Liberty.hh" @@ -129,14 +130,9 @@ LibExprParser::copyInput(char *buf, { size_t length = strlen(func_); if (length == 0) - return 0; + return 0; else { - size_t count; - - if (length < max_size) - count = length; - else - count = max_size; + size_t count = std::min(length, max_size); strncpy(buf, func_, count); func_ += count; return count;