mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
Utilities: Modernize output and comparison in the sort utility
Use the comparison operator of AK/String instead of strcmp(3) and replace fput* by outln.
This commit is contained in:
parent
7d8e036e26
commit
4f0e2f2584
Notes:
sideshowbarker
2024-07-18 04:44:40 +09:00
Author: https://github.com/doctor-rd Commit: https://github.com/SerenityOS/serenity/commit/4f0e2f25840 Pull-request: https://github.com/SerenityOS/serenity/pull/9825
|
@ -37,13 +37,10 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
|
|||
lines.append({ buffer, AK::ShouldChomp::Chomp });
|
||||
}
|
||||
|
||||
quick_sort(lines, [](auto& a, auto& b) {
|
||||
return strcmp(a.characters(), b.characters()) < 0;
|
||||
});
|
||||
quick_sort(lines);
|
||||
|
||||
for (auto& line : lines) {
|
||||
fputs(line.characters(), stdout);
|
||||
fputc('\n', stdout);
|
||||
outln("{}", line);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue