1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:37:35 +00:00

Applications: Change static constexpr variables to constexpr

Function-local `static constexpr` variables can be `constexpr`. This
can reduce memory consumption, binary size, and offer additional
compiler optimizations.
This commit is contained in:
Lenny Maiorani 2022-02-09 17:45:15 -07:00 committed by Andreas Kling
parent 7012a5eb0b
commit 1dd70a6f49
10 changed files with 67 additions and 60 deletions

View file

@ -19,11 +19,6 @@
#include <LibGfx/Color.h>
#include <LibGfx/FontDatabase.h>
static const char* short_month_names[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window)
: Dialog(parent_window)
, m_date_time(date_time)
@ -104,6 +99,11 @@ String AddEventDialog::MonthListModel::column_name(int column) const
GUI::Variant AddEventDialog::MonthListModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
{
constexpr Array short_month_names = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
auto& month = short_month_names[index.row()];
if (role == GUI::ModelRole::Display) {
switch (index.column()) {