From e0a6ed4bc08d00d418343a0ed4ec93d0535b100f Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Mon, 3 Oct 2022 13:08:10 +0200 Subject: [PATCH] LibWasm: Use String::join in Printer where apropriate --- Userland/Libraries/LibWasm/Printer/Printer.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/Userland/Libraries/LibWasm/Printer/Printer.cpp b/Userland/Libraries/LibWasm/Printer/Printer.cpp index 7650720047..bef8d3926e 100644 --- a/Userland/Libraries/LibWasm/Printer/Printer.cpp +++ b/Userland/Libraries/LibWasm/Printer/Printer.cpp @@ -131,27 +131,13 @@ void Printer::print(Wasm::DataSection::Data const& data) [this](DataSection::Data::Passive const& value) { print_indent(); print("(passive init {}xu8 (", value.init.size()); - bool first = true; - for (auto v : value.init) { - if (first) - print("{:x}", v); - else - print(" {:x}", v); - first = false; - } + print(String::join(' ', value.init, "{:x}"sv)); print(")\n"); }, [this](DataSection::Data::Active const& value) { print_indent(); print("(active init {}xu8 (", value.init.size()); - bool first = true; - for (auto v : value.init) { - if (first) - print("{:x}", v); - else - print(" {:x}", v); - first = false; - } + print(String::join(' ', value.init, "{:x}"sv)); print("\n"); { TemporaryChange change { m_indent, m_indent + 1 };