Skip to content

Commit 41b7939

Browse files
renu555cdunn2001
renu555
authored andcommitted
Always true condition.
for (int index = 0; index < size && !isMultiLine; ++index) In addition to dead code, in the above if condition checking to !isMultiLine is of no use as it will be always true and hence "for" depends only on condition [index < size.] The mentioned test case works fine in this case also.
1 parent 66b7738 commit 41b7939

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib_json/json_writer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ bool StyledWriter::isMultineArray(const Value &value) {
341341
childValues_.reserve(size);
342342
addChildValues_ = true;
343343
int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
344-
for (int index = 0; index < size && !isMultiLine; ++index) {
344+
for (int index = 0; index < size; ++index) {
345345
writeValue(value[index]);
346346
lineLength += int(childValues_[index].length());
347347
}
@@ -564,7 +564,7 @@ bool StyledStreamWriter::isMultineArray(const Value &value) {
564564
childValues_.reserve(size);
565565
addChildValues_ = true;
566566
int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
567-
for (int index = 0; index < size && !isMultiLine; ++index) {
567+
for (int index = 0; index < size; ++index) {
568568
writeValue(value[index]);
569569
lineLength += int(childValues_[index].length());
570570
}

0 commit comments

Comments
 (0)