Skip to content

Commit 6f0fee8

Browse files
committed
Get rid of the last instance of stringstream
1 parent 72d7ada commit 6f0fee8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/archive_converter.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include <filesystem>
77
#include <format>
8-
#include <iostream>
98

109
namespace fs = std::filesystem;
1110

@@ -72,14 +71,12 @@ int ArchiveConverter::WriteCpioEntry(archive_entry* ae,
7271
// discard the first line
7372
reader.GetLine(&line);
7473

75-
std::stringstream entry_data;
74+
std::string entry;
7675
while (reader.GetLine(&line) == ARCHIVE_OK) {
7776
// do the copy, with a slash prepended
78-
entry_data << '/' << line << '\n';
77+
std::format_to(std::back_inserter(entry), "/{}\n", line);
7978
}
8079

81-
const std::string entry = entry_data.str();
82-
8380
// adjust the entry size for removing the first line and adding slashes
8481
archive_entry_set_size(ae, entry.size());
8582

0 commit comments

Comments
 (0)