Skip to content

Commit e12a212

Browse files
committed
Remove StringBuilder::appendNumber
https://bugs.webkit.org/show_bug.cgi?id=225732 Reviewed by Sam Weinig. Source/JavaScriptCore: * API/JSContextRef.cpp: (BacktraceFunctor::operator() const): Use append instead of appendNumber. * API/tests/PingPongStackOverflowTest.cpp: (PingPongStackOverflowObject_hasInstance): Ditto. * heap/HeapSnapshotBuilder.cpp: (JSC::HeapSnapshotBuilder::json): Ditto. * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::toString const): Use makeString instead of StringBuilder. * runtime/ConsoleClient.cpp: (JSC::appendURLAndPosition): Ditto. (JSC::ConsoleClient::printConsoleMessageWithArguments): Use append instead of appendNumber. * runtime/JSONObject.cpp: (JSC::Stringifier::appendStringifiedValue): Ditto. * runtime/Options.cpp: (JSC::OptionReader::Option::dump const): Ditto. * runtime/StackFrame.cpp: (JSC::StackFrame::toString const): Use makeString instead of StringBuilder. Source/WebCore: * Modules/indexeddb/server/IndexValueStore.cpp: (WebCore::IDBServer::IndexValueStore::loggingString const): Use append instead of appendNumber. * Modules/websockets/WebSocketHandshake.cpp: (WebCore::hostName): Use makeString instead of StringBuilder. * contentextensions/CombinedURLFilters.cpp: (WebCore::ContentExtensions::prefixTreeVertexToString): Use append instead of appendNumber. * contentextensions/Term.h: (WebCore::ContentExtensions::Term::toString const): Ditto. * css/CSSFontFeatureValue.cpp: (WebCore::CSSFontFeatureValue::customCSSText const): Ditto. * css/CSSTimingFunctionValue.cpp: (WebCore::CSSStepsTimingFunctionValue::customCSSText const): Ditto. * dom/Document.cpp: (WebCore::Document::downgradeReferrerToRegistrableDomain): Use makeString instead of StringBuilder. * editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::generateUniquePrefix): Ditto. * editing/cocoa/DataDetection.mm: (WebCore::dataDetectorStringForPath): Use append instead of appendNumber. * html/HTMLAnchorElement.cpp: (WebCore::appendServerMapMousePosition): Ditto. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::createContext2d): Use makeString instead of StringBuilder. (WebCore::HTMLCanvasElement::createImageBuffer const): Ditto. * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::toString const): Use append instead of appendNumber. * loader/SubresourceIntegrity.cpp: (WebCore::integrityMismatchDescription): Use makeString instead of StringBuilder. * page/IntersectionObserver.cpp: (WebCore::IntersectionObserver::rootMargin const): Use append instead of appendNumber. * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::databaseIdentifier const): Use makeString instead of StringBuilder. * platform/Decimal.cpp: (WebCore::Decimal::toString const): Use append instead of appendNumber. * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::animationNameForTransition): Use makeString instead of StringBuilder. * platform/graphics/ca/TileController.cpp: (WebCore::TileController::createTileLayer): Ditto. * platform/graphics/ca/win/PlatformCALayerWin.cpp: (printTransform): Use single append instead of a run of them. (printLayer): Ditto, and use append instead of apppendNumber. (PlatformCALayerWin::layerTreeAsString const): Ditto. * platform/mediarecorder/MediaRecorderPrivateMock.cpp: (WebCore::MediaRecorderPrivateMock::generateMockCounterString): Use append instead of appendNumber. * platform/network/ProxyServer.cpp: (WebCore::appendProxyServerString): Ditto. * rendering/RenderTreeAsText.cpp: (WebCore::nodePosition): Ditto. * svg/SVGPathUtilities.cpp: (WebCore::buildStringFromPath): Ditto. * testing/Internals.cpp: (WebCore::Internals::parserMetaData): Use makeString instead of StringBuilder. (WebCore::appendOffsets): Use append instead of appendNumber. * testing/MockPageOverlayClient.cpp: (WebCore::MockPageOverlayClient::drawRect): Use makeString instead of StringBuilder. (WebCore::MockPageOverlayClient::mouseEvent): Ditto. * xml/XMLErrors.cpp: (WebCore::XMLErrors::appendErrorMessage): Use append instead of appendNumber. Source/WebDriver: * SessionHost.cpp: (WebDriver::SessionHost::sendCommandToBackend): Use append instead of appendNumber. * socket/HTTPServerSocket.cpp: (WebDriver::HTTPRequestHandler::packHTTPMessage const): Ditto. Source/WebKit: * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::buildList): Use append instead of appendNumber. (WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources): Ditto. (WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const): Ditto. (WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString): Ditto. (WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString): Ditto. * Shared/WebMemorySampler.cpp: (WebKit::WebMemorySampler::appendCurrentMemoryUsageToFile): Ditto. * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewRunJavaScriptCallback): Ditto. * UIProcess/WebBackForwardList.cpp: (WebKit::WebBackForwardList::loggingString): Ditto. * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: (PageResourceLoadClient::didReceiveResponseForResource): Use makeString instead of StringBuilder. * WebProcess/Plugins/PluginView.cpp: (WebKit::buildHTTPHeaders): Use append instead of appendNumber. Source/WebKitLegacy/win: * WebKitStatistics.cpp: (WebKitStatistics::comClassNameCounts): Use append instead of appendNumber. Source/WTF: We originally added StringBuilder::appendNumber to resolve the ambiguity between UChar and uint16_t, but that problem was solved long ago and it is safe to use StringBuilder::append, including the variadic form, on all types of numbers and we'll get the same results we did with appendNumber. * wtf/JSONValues.cpp: (WTF::JSONImpl::Value::writeJSON const): Use append instead of appendNumber. * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::appendNumber): Deleted. * wtf/text/StringBuilder.h: Removed appendNumber. * wtf/text/TextStream.cpp: (WTF::TextStream::operator<<): Use append instead of appendNumber. Tools: * TestWebKitAPI/Tests/WTF/StringBuilder.cpp: Test append with a number instead of appendNumber. * TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp: Use append instead of appendNumber. * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::dumpResponseDescriptionSuitableForTestResult): Use append instead of appendNumber. (WTR::dumpFrameScrollPosition): Ditto. (WTR::InjectedBundlePage::didFinishDocumentLoadForFrame): Use makeString instead of StringBuilder. (WTR::InjectedBundlePage::shouldCacheResponse): Ditto. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (WTR::attributesOfElement): Use append instead of appendNumber. (WTR::AccessibilityUIElement::attributedStringForRange): Ditto. (WTR::stringAtOffset): Ditto. Canonical link: https://commits.webkit.org/237685@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277437 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 86a399a commit e12a212

58 files changed

Lines changed: 469 additions & 758 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/API/JSContextRef.cpp‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,18 +290,12 @@ class BacktraceFunctor {
290290
StringBuilder& builder = m_builder;
291291
if (!builder.isEmpty())
292292
builder.append('\n');
293-
builder.append('#');
294-
builder.appendNumber(visitor->index());
295-
builder.append(' ');
296-
builder.append(visitor->functionName());
297-
builder.appendLiteral("() at ");
298-
builder.append(visitor->sourceURL());
293+
builder.append('#', visitor->index(), ' ', visitor->functionName(), "() at ", visitor->sourceURL());
299294
if (visitor->hasLineAndColumnInfo()) {
300-
builder.append(':');
301295
unsigned lineNumber;
302296
unsigned unusedColumn;
303297
visitor->computeLineAndColumn(lineNumber, unusedColumn);
304-
builder.appendNumber(lineNumber);
298+
builder.append(':', lineNumber);
305299
}
306300

307301
if (!visitor->callee().rawPtr())

‎Source/JavaScriptCore/API/tests/PingPongStackOverflowTest.cpp‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,9 @@ static bool PingPongStackOverflowObject_hasInstance(JSContextRef context, JSObje
5656
} else {
5757
StringBuilder builder;
5858
builder.appendLiteral("dummy.valueOf([0]");
59-
for (int i = 1; i < 35000; i++) {
60-
builder.appendLiteral(", [");
61-
builder.appendNumber(i);
62-
builder.appendLiteral("]");
63-
}
59+
for (int i = 1; i < 35000; i++)
60+
builder.append(", [", i, ']');
6461
builder.appendLiteral(");");
65-
6662
JSStringRef script = JSStringCreateWithUTF8CString(builder.toString().utf8().data());
6763
result = JSEvaluateScript(context, script, nullptr, nullptr, 1, exception);
6864
JSStringRelease(script);

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
2021-05-13 Darin Adler <darin@apple.com>
2+
3+
Remove StringBuilder::appendNumber
4+
https://bugs.webkit.org/show_bug.cgi?id=225732
5+
6+
Reviewed by Sam Weinig.
7+
8+
* API/JSContextRef.cpp:
9+
(BacktraceFunctor::operator() const): Use append instead of appendNumber.
10+
* API/tests/PingPongStackOverflowTest.cpp:
11+
(PingPongStackOverflowObject_hasInstance): Ditto.
12+
* heap/HeapSnapshotBuilder.cpp:
13+
(JSC::HeapSnapshotBuilder::json): Ditto.
14+
15+
* interpreter/StackVisitor.cpp:
16+
(JSC::StackVisitor::Frame::toString const): Use makeString instead of StringBuilder.
17+
18+
* runtime/ConsoleClient.cpp:
19+
(JSC::appendURLAndPosition): Ditto.
20+
(JSC::ConsoleClient::printConsoleMessageWithArguments): Use append instead of appendNumber.
21+
* runtime/JSONObject.cpp:
22+
(JSC::Stringifier::appendStringifiedValue): Ditto.
23+
* runtime/Options.cpp:
24+
(JSC::OptionReader::Option::dump const): Ditto.
25+
26+
* runtime/StackFrame.cpp:
27+
(JSC::StackFrame::toString const): Use makeString instead of StringBuilder.
28+
129
2021-05-12 Geoffrey Garen <ggaren@apple.com>
230

331
ConservativeRoots triggers page demand on Speedometer

‎Source/JavaScriptCore/heap/HeapSnapshotBuilder.cpp‎

Lines changed: 19 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -420,24 +420,10 @@ String HeapSnapshotBuilder::json(Function<bool (const HeapSnapshotNode&)> allowN
420420
}
421421
}
422422

423-
// <nodeId>, <sizeInBytes>, <nodeClassNameIndex>, <flags>, [<labelIndex>, <cellEddress>, <wrappedAddress>]
424-
json.append(',');
425-
json.appendNumber(node.identifier);
426-
json.append(',');
427-
json.appendNumber(node.cell->estimatedSizeInBytes(vm));
428-
json.append(',');
429-
json.appendNumber(classNameIndex);
430-
json.append(',');
431-
json.appendNumber(flags);
432-
if (m_snapshotType == SnapshotType::GCDebuggingSnapshot) {
433-
json.append(',');
434-
json.appendNumber(labelIndex);
435-
json.appendLiteral(",\"0x");
436-
json.append(hex(reinterpret_cast<uintptr_t>(node.cell), Lowercase));
437-
json.appendLiteral("\",\"0x");
438-
json.append(hex(reinterpret_cast<uintptr_t>(wrappedAddress), Lowercase));
439-
json.append('"');
440-
}
423+
// <nodeId>, <sizeInBytes>, <nodeClassNameIndex>, <flags>, [<labelIndex>, <cellAddress>, <wrappedAddress>]
424+
json.append(',', node.identifier, ',', node.cell->estimatedSizeInBytes(vm), ',', classNameIndex, ',', flags);
425+
if (m_snapshotType == SnapshotType::GCDebuggingSnapshot)
426+
json.append(',', labelIndex, ",\"0x", hex(reinterpret_cast<uintptr_t>(node.cell), Lowercase), "\",\"0x", hex(reinterpret_cast<uintptr_t>(wrappedAddress), Lowercase), '"');
441427
};
442428

443429
bool firstEdge = true;
@@ -447,24 +433,19 @@ String HeapSnapshotBuilder::json(Function<bool (const HeapSnapshotNode&)> allowN
447433
firstEdge = false;
448434

449435
// <fromNodeId>, <toNodeId>, <edgeTypeIndex>, <edgeExtraData>
450-
json.appendNumber(edge.from.identifier);
451-
json.append(',');
452-
json.appendNumber(edge.to.identifier);
453-
json.append(',');
454-
json.appendNumber(edgeTypeToNumber(edge.type));
455-
json.append(',');
436+
json.append(edge.from.identifier, ',', edge.to.identifier, ',', edgeTypeToNumber(edge.type), ',');
456437
switch (edge.type) {
457438
case EdgeType::Property:
458439
case EdgeType::Variable: {
459440
auto result = edgeNameIndexes.add(edge.u.name, nextEdgeNameIndex);
460441
if (result.isNewEntry)
461442
nextEdgeNameIndex++;
462443
unsigned edgeNameIndex = result.iterator->value;
463-
json.appendNumber(edgeNameIndex);
444+
json.append(edgeNameIndex);
464445
break;
465446
}
466447
case EdgeType::Index:
467-
json.appendNumber(edge.u.index);
448+
json.append(edge.u.index);
468449
break;
469450
default:
470451
// No data for this edge type.
@@ -473,20 +454,15 @@ String HeapSnapshotBuilder::json(Function<bool (const HeapSnapshotNode&)> allowN
473454
}
474455
};
475456

476-
json.append('{');
477-
478457
// version
479-
json.appendLiteral("\"version\":2");
458+
json.appendLiteral("{\"version\":2");
480459

481460
// type
482-
json.append(',');
483-
json.appendLiteral("\"type\":");
461+
json.appendLiteral(",\"type\":");
484462
json.appendQuotedJSONString(snapshotTypeToString(m_snapshotType));
485463

486464
// nodes
487-
json.append(',');
488-
json.appendLiteral("\"nodes\":");
489-
json.append('[');
465+
json.appendLiteral(",\"nodes\":[");
490466
// <root>
491467
if (m_snapshotType == SnapshotType::GCDebuggingSnapshot)
492468
json.appendLiteral("0,0,0,0,0,\"0x0\",\"0x0\"");
@@ -500,9 +476,7 @@ String HeapSnapshotBuilder::json(Function<bool (const HeapSnapshotNode&)> allowN
500476
json.append(']');
501477

502478
// node class names
503-
json.append(',');
504-
json.appendLiteral("\"nodeClassNames\":");
505-
json.append('[');
479+
json.appendLiteral(",\"nodeClassNames\":[");
506480
Vector<String> orderedClassNames(classNameIndexes.size());
507481
for (auto& entry : classNameIndexes)
508482
orderedClassNames[entry.value] = entry.key;
@@ -558,17 +532,13 @@ String HeapSnapshotBuilder::json(Function<bool (const HeapSnapshotNode&)> allowN
558532
});
559533

560534
// edges
561-
json.append(',');
562-
json.appendLiteral("\"edges\":");
563-
json.append('[');
535+
json.appendLiteral(",\"edges\":[");
564536
for (auto& edge : m_edges)
565537
appendEdgeJSON(edge);
566538
json.append(']');
567539

568540
// edge types
569-
json.append(',');
570-
json.appendLiteral("\"edgeTypes\":");
571-
json.append('[');
541+
json.appendLiteral(",\"edgeTypes\":['");
572542
json.appendQuotedJSONString(edgeTypeToString(EdgeType::Internal));
573543
json.append(',');
574544
json.appendQuotedJSONString(edgeTypeToString(EdgeType::Property));
@@ -579,9 +549,7 @@ String HeapSnapshotBuilder::json(Function<bool (const HeapSnapshotNode&)> allowN
579549
json.append(']');
580550

581551
// edge names
582-
json.append(',');
583-
json.appendLiteral("\"edgeNames\":");
584-
json.append('[');
552+
json.appendLiteral(",\"edgeNames\":[");
585553
Vector<UniquedStringImpl*> orderedEdgeNames(edgeNameIndexes.size());
586554
for (auto& entry : edgeNameIndexes)
587555
orderedEdgeNames[entry.value] = entry.key;
@@ -597,9 +565,7 @@ String HeapSnapshotBuilder::json(Function<bool (const HeapSnapshotNode&)> allowN
597565
json.append(']');
598566

599567
if (m_snapshotType == SnapshotType::GCDebuggingSnapshot) {
600-
json.append(',');
601-
json.appendLiteral("\"roots\":");
602-
json.append('[');
568+
json.appendLiteral(",\"roots\":[");
603569

604570
HeapSnapshot* snapshot = m_profiler.mostRecentSnapshot();
605571

@@ -615,16 +581,14 @@ String HeapSnapshotBuilder::json(Function<bool (const HeapSnapshotNode&)> allowN
615581
json.append(',');
616582

617583
firstNode = false;
618-
json.appendNumber(snapshotNode.value().identifier);
584+
json.append(snapshotNode.value().identifier);
619585

620586
// Maybe we should just always encode the root names.
621587
const char* rootName = rootMarkReasonDescription(it.value.markReason);
622588
auto result = labelIndexes.add(rootName, nextLabelIndex);
623589
if (result.isNewEntry)
624590
nextLabelIndex++;
625-
unsigned labelIndex = result.iterator->value;
626-
json.append(',');
627-
json.appendNumber(labelIndex);
591+
json.append(',', result.iterator->value);
628592

629593
unsigned reachabilityReasonIndex = 0;
630594
if (it.value.reachabilityFromOpaqueRootReasons) {
@@ -633,18 +597,15 @@ String HeapSnapshotBuilder::json(Function<bool (const HeapSnapshotNode&)> allowN
633597
nextLabelIndex++;
634598
reachabilityReasonIndex = result.iterator->value;
635599
}
636-
json.append(',');
637-
json.appendNumber(reachabilityReasonIndex);
600+
json.append(',', reachabilityReasonIndex);
638601
}
639602

640603
json.append(']');
641604
}
642605

643606
if (m_snapshotType == SnapshotType::GCDebuggingSnapshot) {
644607
// internal node descriptions
645-
json.append(',');
646-
json.appendLiteral("\"labels\":");
647-
json.append('[');
608+
json.appendLiteral(",\"labels\":[");
648609

649610
Vector<String> orderedLabels(labelIndexes.size());
650611
for (auto& entry : labelIndexes)

‎Source/JavaScriptCore/interpreter/StackVisitor.cpp‎

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "WasmCallee.h"
3535
#include "WasmIndexOrName.h"
3636
#include "WebAssemblyFunction.h"
37-
#include <wtf/text/StringBuilder.h>
37+
#include <wtf/text/StringConcatenateNumbers.h>
3838

3939
namespace JSC {
4040

@@ -338,25 +338,17 @@ String StackVisitor::Frame::sourceURL() const
338338

339339
String StackVisitor::Frame::toString() const
340340
{
341-
StringBuilder traceBuild;
342341
String functionName = this->functionName();
343342
String sourceURL = this->sourceURL();
344-
traceBuild.append(functionName);
345-
if (!sourceURL.isEmpty()) {
346-
if (!functionName.isEmpty())
347-
traceBuild.append('@');
348-
traceBuild.append(sourceURL);
349-
if (hasLineAndColumnInfo()) {
350-
unsigned line = 0;
351-
unsigned column = 0;
352-
computeLineAndColumn(line, column);
353-
traceBuild.append(':');
354-
traceBuild.appendNumber(line);
355-
traceBuild.append(':');
356-
traceBuild.appendNumber(column);
357-
}
358-
}
359-
return traceBuild.toString().impl();
343+
const char* separator = !sourceURL.isEmpty() && !functionName.isEmpty() ? "@" : "";
344+
345+
if (sourceURL.isEmpty() || !hasLineAndColumnInfo())
346+
return makeString(functionName, separator, sourceURL);
347+
348+
unsigned line = 0;
349+
unsigned column = 0;
350+
computeLineAndColumn(line, column);
351+
return makeString(functionName, separator, sourceURL, ':', line, ':', column);
360352
}
361353

362354
intptr_t StackVisitor::Frame::sourceID()

‎Source/JavaScriptCore/runtime/ConsoleClient.cpp‎

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,11 @@ static void appendURLAndPosition(StringBuilder& builder, const String& url, unsi
4848

4949
builder.append(url);
5050

51-
if (lineNumber > 0) {
52-
builder.append(':');
53-
builder.appendNumber(lineNumber);
54-
}
51+
if (lineNumber > 0)
52+
builder.append(':', lineNumber);
5553

56-
if (columnNumber > 0) {
57-
builder.append(':');
58-
builder.appendNumber(columnNumber);
59-
}
54+
if (columnNumber > 0)
55+
builder.append(':', columnNumber);
6056
}
6157

6258
static void appendMessagePrefix(StringBuilder& builder, MessageSource source, MessageType type, MessageLevel level)
@@ -236,15 +232,12 @@ void ConsoleClient::printConsoleMessageWithArguments(MessageSource source, Messa
236232
if (isTraceMessage) {
237233
for (size_t i = 0; i < callStack->size(); ++i) {
238234
const ScriptCallFrame& callFrame = callStack->at(i);
239-
String functionName = String(callFrame.functionName());
235+
String functionName = callFrame.functionName();
240236
if (functionName.isEmpty())
241237
functionName = "(unknown)"_s;
242238

243239
StringBuilder callFrameBuilder;
244-
callFrameBuilder.appendNumber(i);
245-
callFrameBuilder.appendLiteral(": ");
246-
callFrameBuilder.append(functionName);
247-
callFrameBuilder.append('(');
240+
callFrameBuilder.append(i, ": ", functionName, '(');
248241
appendURLAndPosition(callFrameBuilder, callFrame.sourceURL(), callFrame.lineNumber(), callFrame.columnNumber());
249242
callFrameBuilder.append(')');
250243

‎Source/JavaScriptCore/runtime/JSONObject.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,13 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder&
363363

364364
if (value.isNumber()) {
365365
if (value.isInt32())
366-
builder.appendNumber(value.asInt32());
366+
builder.append(value.asInt32());
367367
else {
368368
double number = value.asNumber();
369369
if (!std::isfinite(number))
370370
builder.appendLiteral("null");
371371
else
372-
builder.appendNumber(number);
372+
builder.append(number);
373373
}
374374
return StringifySucceeded;
375375
}

‎Source/JavaScriptCore/runtime/Options.cpp‎

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,34 +1084,27 @@ void OptionReader::Option::dump(StringBuilder& builder) const
10841084
builder.append(m_bool ? "true" : "false");
10851085
break;
10861086
case Options::Type::Unsigned:
1087-
builder.appendNumber(m_unsigned);
1087+
builder.append(m_unsigned);
10881088
break;
10891089
case Options::Type::Size:
1090-
builder.appendNumber(m_size);
1090+
builder.append(m_size);
10911091
break;
10921092
case Options::Type::Double:
10931093
builder.append(m_double);
10941094
break;
10951095
case Options::Type::Int32:
1096-
builder.appendNumber(m_int32);
1096+
builder.append(m_int32);
10971097
break;
10981098
case Options::Type::OptionRange:
10991099
builder.append(m_optionRange.rangeString());
11001100
break;
1101-
case Options::Type::OptionString: {
1102-
const char* option = m_optionString;
1103-
if (!option)
1104-
option = "";
1105-
builder.append('"');
1106-
builder.append(option);
1107-
builder.append('"');
1101+
case Options::Type::OptionString:
1102+
builder.append('"', m_optionString ? m_optionString : "", '"');
11081103
break;
1109-
}
1110-
case Options::Type::GCLogLevel: {
1104+
case Options::Type::GCLogLevel:
11111105
builder.append(GCLogging::levelAsString(m_gcLogLevel));
11121106
break;
11131107
}
1114-
}
11151108
}
11161109

11171110
bool OptionReader::Option::operator==(const Option& other) const

0 commit comments

Comments
 (0)