1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:57:34 +00:00

LibCore+Everywhere: Remove ArgsParser::add*(char const*&)

This is not guaranteed to always work correctly as ArgsParser deals in
StringViews and might have a non-properly-null-terminated string as a
value. As a bonus, using StringView (and DeprecatedString where
necessary) leads to nicer looking code too :^)
This commit is contained in:
Ali Mohammad Pur 2023-03-01 00:11:43 +03:30 committed by Andreas Kling
parent 60908adcbe
commit 500044906d
43 changed files with 122 additions and 145 deletions

View file

@ -30,7 +30,7 @@ static Optional<size_t> count;
static uint32_t total_ms;
static int min_ms;
static int max_ms;
static char const* host;
static DeprecatedString host;
static int payload_size = -1;
// variable part of header can be 0 to 40 bytes
// https://datatracker.ietf.org/doc/html/rfc791#section-3.1
@ -88,7 +88,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)));
auto* hostent = gethostbyname(host);
auto* hostent = gethostbyname(host.characters());
if (!hostent) {
warnln("Lookup failed for '{}'", host);
return 1;