1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 17:17:45 +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

@ -5,6 +5,7 @@
*/
#include "TreeMapWidget.h"
#include <AK/Array.h>
#include <AK/NumberFormat.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/Painter.h>
@ -15,7 +16,7 @@ REGISTER_WIDGET(SpaceAnalyzer, TreeMapWidget)
namespace SpaceAnalyzer {
static const Color colors[] = {
static constexpr Array colors = {
Color(253, 231, 37),
Color(148, 216, 64),
Color(60, 188, 117),

View file

@ -8,6 +8,7 @@
#include <AK/LexicalPath.h>
#include <AK/Queue.h>
#include <AK/QuickSort.h>
#include <AK/StringView.h>
#include <AK/URL.h>
#include <Applications/SpaceAnalyzer/SpaceAnalyzerGML.h>
#include <LibCore/DirIterator.h>
@ -29,7 +30,7 @@
#include <sys/stat.h>
#include <unistd.h>
static const char* APP_NAME = "Space Analyzer";
static constexpr StringView APP_NAME = "Space Analyzer";
static constexpr size_t FILES_ENCOUNTERED_UPDATE_STEP_SIZE = 25;
struct TreeNode : public SpaceAnalyzer::TreeMapNode {