1
0
Fork 0

Codechange: Use range-for and std::size with _plural_forms.

This removes indexed array access and use of `lengthof()` macro.
pull/12852/head
Peter Nelson 2024-07-09 20:08:09 +01:00
parent b4bcb330c7
commit b45a3a1047
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
1 changed files with 3 additions and 3 deletions

View File

@ -250,8 +250,8 @@ struct HeaderFileWriter : HeaderWriter, FileWriter {
{ {
/* Find the plural form with the most amount of cases. */ /* Find the plural form with the most amount of cases. */
int max_plural_forms = 0; int max_plural_forms = 0;
for (uint i = 0; i < lengthof(_plural_forms); i++) { for (const auto &pf : _plural_forms) {
max_plural_forms = std::max(max_plural_forms, _plural_forms[i].plural_count); max_plural_forms = std::max(max_plural_forms, pf.plural_count);
} }
fmt::print(this->output_stream, fmt::print(this->output_stream,
@ -261,7 +261,7 @@ struct HeaderFileWriter : HeaderWriter, FileWriter {
"static const uint LANGUAGE_MAX_PLURAL_FORMS = {};\n" "static const uint LANGUAGE_MAX_PLURAL_FORMS = {};\n"
"static const uint LANGUAGE_TOTAL_STRINGS = {};\n" "static const uint LANGUAGE_TOTAL_STRINGS = {};\n"
"\n", "\n",
data.Version(), lengthof(_plural_forms), max_plural_forms, total_strings data.Version(), std::size(_plural_forms), max_plural_forms, total_strings
); );
this->output_stream << "#endif /* TABLE_STRINGS_H */\n"; this->output_stream << "#endif /* TABLE_STRINGS_H */\n";