Skip to content

Commit abc1e07

Browse files
committed
Prefer appending character constants over string literals - correct patch.
Submitting correct patch for open-source-parsers#61
1 parent 00b0a1b commit abc1e07

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/lib_json/json_writer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,28 +217,28 @@ void FastWriter::writeValue(const Value& value) {
217217
document_ += valueToString(value.asBool());
218218
break;
219219
case arrayValue: {
220-
document_ += "[";
220+
document_ += '[';
221221
int size = value.size();
222222
for (int index = 0; index < size; ++index) {
223223
if (index > 0)
224-
document_ += ",";
224+
document_ += ',';
225225
writeValue(value[index]);
226226
}
227-
document_ += "]";
227+
document_ += ']';
228228
} break;
229229
case objectValue: {
230230
Value::Members members(value.getMemberNames());
231-
document_ += "{";
231+
document_ += '{';
232232
for (Value::Members::iterator it = members.begin(); it != members.end();
233233
++it) {
234234
const std::string& name = *it;
235235
if (it != members.begin())
236-
document_ += ",";
236+
document_ += ',';
237237
document_ += valueToQuotedString(name.c_str());
238238
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
239239
writeValue(value[name]);
240240
}
241-
document_ += "}";
241+
document_ += '}';
242242
} break;
243243
}
244244
}
@@ -302,7 +302,7 @@ void StyledWriter::writeValue(const Value& value) {
302302
writeCommentAfterValueOnSameLine(childValue);
303303
break;
304304
}
305-
document_ += ",";
305+
document_ += ',';
306306
writeCommentAfterValueOnSameLine(childValue);
307307
}
308308
unindent();
@@ -336,7 +336,7 @@ void StyledWriter::writeArrayValue(const Value& value) {
336336
writeCommentAfterValueOnSameLine(childValue);
337337
break;
338338
}
339-
document_ += ",";
339+
document_ += ',';
340340
writeCommentAfterValueOnSameLine(childValue);
341341
}
342342
unindent();

0 commit comments

Comments
 (0)