1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

Everywhere: Add sv suffix to strings relying on StringView(char const*)

Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
This commit is contained in:
sin-ack 2022-07-11 17:32:29 +00:00 committed by Andreas Kling
parent e5f09ea170
commit 3f3f45580a
762 changed files with 8315 additions and 8316 deletions

View file

@ -79,7 +79,7 @@ struct AK::Formatter<DateTime> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, DateTime const& date_time)
{
return Formatter<FormatString>::format(builder,
"{{ {}, {}, {}, {}, {}, {}, {}, {}, {} }}",
"{{ {}, {}, {}, {}, {}, {}, {}, {}, {} }}"sv,
date_time.year,
date_time.month.value_or(1),
date_time.day.value_or(1),
@ -97,7 +97,7 @@ struct AK::Formatter<TimeZoneOffset> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, TimeZoneOffset const& time_zone_offset)
{
return Formatter<FormatString>::format(builder,
"{{ {}, {}, {}, {}, {}, {}, {} }}",
"{{ {}, {}, {}, {}, {}, {}, {} }}"sv,
time_zone_offset.offset,
time_zone_offset.until.value_or({}),
time_zone_offset.until.has_value(),
@ -113,7 +113,7 @@ struct AK::Formatter<DaylightSavingsOffset> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, DaylightSavingsOffset const& dst_offset)
{
return Formatter<FormatString>::format(builder,
"{{ {}, {}, {}, {}, {} }}",
"{{ {}, {}, {}, {}, {} }}"sv,
dst_offset.offset,
dst_offset.year_from,
dst_offset.year_to,
@ -127,7 +127,7 @@ struct AK::Formatter<TimeZone::Coordinate> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, TimeZone::Coordinate const& coordinate)
{
return Formatter<FormatString>::format(builder,
"{{ {}, {}, {} }}",
"{{ {}, {}, {} }}"sv,
coordinate.degrees,
coordinate.minutes,
coordinate.seconds);
@ -139,7 +139,7 @@ struct AK::Formatter<TimeZone::Location> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, TimeZone::Location const& location)
{
return Formatter<FormatString>::format(builder,
"{{ {}, {} }}",
"{{ {}, {} }}"sv,
location.latitude,
location.longitude);
}
@ -557,19 +557,19 @@ static constexpr Array<@type@, @size@> @name@ { {
generator.append("} };\n");
};
generate_mapping(generator, time_zone_data.time_zone_names, "TimeZoneOffset"sv, "s_time_zone_offsets"sv, "s_time_zone_offsets_{}", format_identifier,
generate_mapping(generator, time_zone_data.time_zone_names, "TimeZoneOffset"sv, "s_time_zone_offsets"sv, "s_time_zone_offsets_{}"sv, format_identifier,
[&](auto const& name, auto const& value) {
auto const& time_zone_offsets = time_zone_data.time_zones.find(value)->value;
append_offsets(name, "TimeZoneOffset"sv, time_zone_offsets);
});
generate_mapping(generator, time_zone_data.dst_offset_names, "DaylightSavingsOffset"sv, "s_dst_offsets"sv, "s_dst_offsets_{}", format_identifier,
generate_mapping(generator, time_zone_data.dst_offset_names, "DaylightSavingsOffset"sv, "s_dst_offsets"sv, "s_dst_offsets_{}"sv, format_identifier,
[&](auto const& name, auto const& value) {
auto const& dst_offsets = time_zone_data.dst_offsets.find(value)->value;
append_offsets(name, "DaylightSavingsOffset"sv, dst_offsets);
});
generate_mapping(generator, time_zone_data.time_zone_region_names, s_string_index_type, "s_regional_time_zones"sv, "s_regional_time_zones_{}", format_identifier,
generate_mapping(generator, time_zone_data.time_zone_region_names, s_string_index_type, "s_regional_time_zones"sv, "s_regional_time_zones_{}"sv, format_identifier,
[&](auto const& name, auto const& value) {
auto const& time_zones = time_zone_data.time_zone_regions.find(value)->value;
@ -581,7 +581,7 @@ static constexpr Array<@string_index_type@, @size@> @name@ { {)~~~");
bool first = true;
for (auto const& time_zone : time_zones) {
generator.append(first ? " " : ", ");
generator.append(first ? " "sv : ", "sv);
generator.append(String::number(time_zone));
first = false;
}