From 6ee0bff822723fdff71a49124be5af0e1c7fbe8a Mon Sep 17 00:00:00 2001 From: Gaurav Date: Tue, 22 Sep 2015 09:48:54 +0530 Subject: [PATCH] Remove conditional check for isMultiLine At all 3 places isMultiLine is checked in for loop : for (int index = 0; index < size && !isMultiLine; ++index) { It means !isMultiLine is always true (otherwise do not enter loop), so || condition does not depend on isMultiLine, so removed that. --- src/lib_json/json_writer.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index aaeda7a..f4f1b7f 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -489,8 +489,7 @@ bool StyledWriter::isMultineArray(const Value& value) { childValues_.clear(); for (int index = 0; index < size && !isMultiLine; ++index) { const Value& childValue = value[index]; - isMultiLine = - isMultiLine || ((childValue.isArray() || childValue.isObject()) && + isMultiLine = ((childValue.isArray() || childValue.isObject()) && childValue.size() > 0); } if (!isMultiLine) // check if line length > max line length @@ -709,8 +708,7 @@ bool StyledStreamWriter::isMultineArray(const Value& value) { childValues_.clear(); for (int index = 0; index < size && !isMultiLine; ++index) { const Value& childValue = value[index]; - isMultiLine = - isMultiLine || ((childValue.isArray() || childValue.isObject()) && + isMultiLine = ((childValue.isArray() || childValue.isObject()) && childValue.size() > 0); } if (!isMultiLine) // check if line length > max line length @@ -989,8 +987,7 @@ bool BuiltStyledStreamWriter::isMultineArray(Value const& value) { childValues_.clear(); for (int index = 0; index < size && !isMultiLine; ++index) { Value const& childValue = value[index]; - isMultiLine = - isMultiLine || ((childValue.isArray() || childValue.isObject()) && + isMultiLine = ((childValue.isArray() || childValue.isObject()) && childValue.size() > 0); } if (!isMultiLine) // check if line length > max line length