mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 14:14:45 +03:00
Userland: static vs non-static constexpr variables
Problem: - `static` variables consume memory and sometimes are less optimizable. - `static const` variables can be `constexpr`, usually. - `static` function-local variables require an initialization check every time the function is run. Solution: - If a global `static` variable is only used in a single function then move it into the function and make it non-`static` and `constexpr`. - Make all global `static` variables `constexpr` instead of `const`. - Change function-local `static const[expr]` variables to be just `constexpr`.
This commit is contained in:
parent
17ff895e1c
commit
800ea8ea96
Notes:
sideshowbarker
2024-07-18 17:38:29 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/800ea8ea969 Pull-request: https://github.com/SerenityOS/serenity/pull/7318 Reviewed-by: https://github.com/IdanHo
@ -7,6 +7,7 @@
|
||||
#include "CookieJar.h"
|
||||
#include <AK/IPv4Address.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/URL.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibWeb/Cookie/ParsedCookie.h>
|
||||
@ -48,9 +49,9 @@ void CookieJar::set_cookie(const URL& url, const Web::Cookie::ParsedCookie& pars
|
||||
|
||||
void CookieJar::dump_cookies() const
|
||||
{
|
||||
static const char* key_color = "\033[34;1m";
|
||||
static const char* attribute_color = "\033[33m";
|
||||
static const char* no_color = "\033[0m";
|
||||
constexpr StringView key_color = "\033[34;1m";
|
||||
constexpr StringView attribute_color = "\033[33m";
|
||||
constexpr StringView no_color = "\033[0m";
|
||||
|
||||
StringBuilder builder;
|
||||
builder.appendff("{} cookies stored\n", m_cookies.size());
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "AddEventDialog.h"
|
||||
#include <AK/StringView.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
@ -20,11 +21,6 @@
|
||||
#include <LibGfx/Font.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)
|
||||
@ -121,6 +117,11 @@ String AddEventDialog::MonthListModel::column_name(int column) const
|
||||
|
||||
GUI::Variant AddEventDialog::MonthListModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
{
|
||||
constexpr StringView 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()) {
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "GlyphMapWidget.h"
|
||||
#include "NewFontDialog.h"
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/UnicodeUtils.h>
|
||||
#include <Applications/FontEditor/FontEditorWindowGML.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
@ -37,19 +38,19 @@
|
||||
#include <LibGfx/TextDirection.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static constexpr int s_pangram_count = 7;
|
||||
static const char* pangrams[s_pangram_count] = {
|
||||
"quick fox jumps nightly above wizard",
|
||||
"five quacking zephyrs jolt my wax bed",
|
||||
"pack my box with five dozen liquor jugs",
|
||||
"quick brown fox jumps over the lazy dog",
|
||||
"waxy and quivering jocks fumble the pizza",
|
||||
"~#:[@_1%]*{$2.3}/4^(5'6\")-&|7+8!=<9,0\\>?;",
|
||||
"byxfjärmat föl gick på duvshowen"
|
||||
};
|
||||
|
||||
static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor)
|
||||
{
|
||||
constexpr int pangram_count = 7;
|
||||
constexpr StringView pangrams[pangram_count] = {
|
||||
"quick fox jumps nightly above wizard",
|
||||
"five quacking zephyrs jolt my wax bed",
|
||||
"pack my box with five dozen liquor jugs",
|
||||
"quick brown fox jumps over the lazy dog",
|
||||
"waxy and quivering jocks fumble the pizza",
|
||||
"~#:[@_1%]*{$2.3}/4^(5'6\")-&|7+8!=<9,0\\>?;",
|
||||
"byxfjärmat föl gick på duvshowen"
|
||||
};
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_window_type(GUI::WindowType::ToolWindow);
|
||||
window->set_title("Font preview");
|
||||
@ -94,7 +95,7 @@ static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor)
|
||||
reload_button.set_fixed_width(22);
|
||||
reload_button.on_click = [&] {
|
||||
static int i = 1;
|
||||
if (i >= s_pangram_count)
|
||||
if (i >= pangram_count)
|
||||
i = 0;
|
||||
preview_textbox.set_text(pangrams[i]);
|
||||
i++;
|
||||
|
@ -5,9 +5,9 @@
|
||||
*/
|
||||
|
||||
#include "FindDialog.h"
|
||||
#include <AK/Array.h>
|
||||
#include <AK/Hex.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/Label.h>
|
||||
@ -19,17 +19,12 @@
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
|
||||
struct Option {
|
||||
String title;
|
||||
StringView title;
|
||||
OptionId opt;
|
||||
bool enabled;
|
||||
bool default_action;
|
||||
};
|
||||
|
||||
static const Vector<Option> options = {
|
||||
{ "ACII String", OPTION_ASCII_STRING, true, true },
|
||||
{ "Hex value", OPTION_HEX_VALUE, true, false },
|
||||
};
|
||||
|
||||
int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer)
|
||||
{
|
||||
auto dialog = FindDialog::construct();
|
||||
@ -88,6 +83,11 @@ Result<ByteBuffer, String> FindDialog::process_input(String text_value, OptionId
|
||||
FindDialog::FindDialog()
|
||||
: Dialog(nullptr)
|
||||
{
|
||||
constexpr Array options = {
|
||||
Option { "ACII String", OPTION_ASCII_STRING, true, true },
|
||||
Option { "Hex value", OPTION_HEX_VALUE, true, false },
|
||||
};
|
||||
|
||||
resize(280, 180 + ((static_cast<int>(options.size()) - 3) * 16));
|
||||
center_on_screen();
|
||||
set_resizable(false);
|
||||
@ -113,7 +113,7 @@ FindDialog::FindDialog()
|
||||
radio.set_enabled(action.enabled);
|
||||
radio.set_text(action.title);
|
||||
|
||||
radio.on_checked = [this, i](auto) {
|
||||
radio.on_checked = [&](auto) {
|
||||
m_selected_option = options[i].opt;
|
||||
};
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "TreeMapWidget.h"
|
||||
#include <AK/Array.h>
|
||||
#include <AK/NumberFormat.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/WindowServerConnection.h>
|
||||
@ -24,7 +25,7 @@ TreeMapWidget::~TreeMapWidget()
|
||||
{
|
||||
}
|
||||
|
||||
static const Color colors[] = {
|
||||
static constexpr Array colors = {
|
||||
Color(253, 231, 37),
|
||||
Color(148, 216, 64),
|
||||
Color(60, 188, 117),
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <AK/Queue.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/URL.h>
|
||||
#include <Applications/SpaceAnalyzer/SpaceAnalyzerGML.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
@ -27,8 +28,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static const char* APP_NAME = "Space Analyzer";
|
||||
|
||||
struct TreeNode : public SpaceAnalyzer::TreeMapNode {
|
||||
TreeNode(String name)
|
||||
: m_name(move(name)) {};
|
||||
@ -253,6 +252,8 @@ static String get_absolute_path_to_selected_node(const SpaceAnalyzer::TreeMapWid
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
constexpr StringView APP_NAME = "Space Analyzer";
|
||||
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
|
||||
RefPtr<Tree> tree = adopt_ref(*new Tree(""));
|
||||
|
@ -22,6 +22,7 @@
|
||||
* [ ] handle fire bitmap edges better
|
||||
*/
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
@ -38,22 +39,9 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define FIRE_WIDTH 320
|
||||
#define FIRE_HEIGHT 168
|
||||
#define FIRE_MAX 29
|
||||
|
||||
static const Color s_palette[] = {
|
||||
Color(0x07, 0x07, 0x07), Color(0x1F, 0x07, 0x07), Color(0x2F, 0x0F, 0x07),
|
||||
Color(0x47, 0x0F, 0x07), Color(0x57, 0x17, 0x07), Color(0x67, 0x1F, 0x07),
|
||||
Color(0x77, 0x1F, 0x07), Color(0x9F, 0x2F, 0x07), Color(0xAF, 0x3F, 0x07),
|
||||
Color(0xBF, 0x47, 0x07), Color(0xC7, 0x47, 0x07), Color(0xDF, 0x4F, 0x07),
|
||||
Color(0xDF, 0x57, 0x07), Color(0xD7, 0x5F, 0x07), Color(0xD7, 0x5F, 0x07),
|
||||
Color(0xD7, 0x67, 0x0F), Color(0xCF, 0x6F, 0x0F), Color(0xCF, 0x7F, 0x0F),
|
||||
Color(0xCF, 0x87, 0x17), Color(0xC7, 0x87, 0x17), Color(0xC7, 0x8F, 0x17),
|
||||
Color(0xC7, 0x97, 0x1F), Color(0xBF, 0x9F, 0x1F), Color(0xBF, 0xA7, 0x27),
|
||||
Color(0xBF, 0xAF, 0x2F), Color(0xB7, 0xAF, 0x2F), Color(0xB7, 0xB7, 0x37),
|
||||
Color(0xCF, 0xCF, 0x6F), Color(0xEF, 0xEF, 0xC7), Color(0xFF, 0xFF, 0xFF)
|
||||
};
|
||||
static constexpr auto FIRE_WIDTH = 320;
|
||||
static constexpr auto FIRE_HEIGHT = 168;
|
||||
static constexpr auto FIRE_MAX = 29;
|
||||
|
||||
class Fire : public GUI::Widget {
|
||||
C_OBJECT(Fire)
|
||||
@ -80,11 +68,24 @@ private:
|
||||
|
||||
Fire::Fire()
|
||||
{
|
||||
constexpr Array palette = {
|
||||
Color(0x07, 0x07, 0x07), Color(0x1F, 0x07, 0x07), Color(0x2F, 0x0F, 0x07),
|
||||
Color(0x47, 0x0F, 0x07), Color(0x57, 0x17, 0x07), Color(0x67, 0x1F, 0x07),
|
||||
Color(0x77, 0x1F, 0x07), Color(0x9F, 0x2F, 0x07), Color(0xAF, 0x3F, 0x07),
|
||||
Color(0xBF, 0x47, 0x07), Color(0xC7, 0x47, 0x07), Color(0xDF, 0x4F, 0x07),
|
||||
Color(0xDF, 0x57, 0x07), Color(0xD7, 0x5F, 0x07), Color(0xD7, 0x5F, 0x07),
|
||||
Color(0xD7, 0x67, 0x0F), Color(0xCF, 0x6F, 0x0F), Color(0xCF, 0x7F, 0x0F),
|
||||
Color(0xCF, 0x87, 0x17), Color(0xC7, 0x87, 0x17), Color(0xC7, 0x8F, 0x17),
|
||||
Color(0xC7, 0x97, 0x1F), Color(0xBF, 0x9F, 0x1F), Color(0xBF, 0xA7, 0x27),
|
||||
Color(0xBF, 0xAF, 0x2F), Color(0xB7, 0xAF, 0x2F), Color(0xB7, 0xB7, 0x37),
|
||||
Color(0xCF, 0xCF, 0x6F), Color(0xEF, 0xEF, 0xC7), Color(0xFF, 0xFF, 0xFF)
|
||||
};
|
||||
|
||||
bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::Indexed8, { 320, 200 });
|
||||
|
||||
/* Initialize fire palette */
|
||||
for (int i = 0; i < 30; i++)
|
||||
bitmap->set_palette_color(i, s_palette[i]);
|
||||
bitmap->set_palette_color(i, palette[i]);
|
||||
|
||||
/* Set remaining entries to white */
|
||||
for (int i = 30; i < 256; i++)
|
||||
|
@ -14,8 +14,8 @@ class Game final : public GUI::Widget {
|
||||
C_OBJECT(Game);
|
||||
|
||||
public:
|
||||
static const int game_width = 480;
|
||||
static const int game_height = 500;
|
||||
static constexpr int game_width = 480;
|
||||
static constexpr int game_height = 500;
|
||||
|
||||
virtual ~Game() override;
|
||||
|
||||
|
@ -22,8 +22,8 @@ class Game final : public GUI::Widget {
|
||||
C_OBJECT(Game);
|
||||
|
||||
public:
|
||||
static const int game_width = 560;
|
||||
static const int game_height = 480;
|
||||
static constexpr int game_width = 560;
|
||||
static constexpr int game_height = 480;
|
||||
|
||||
virtual ~Game() override;
|
||||
|
||||
|
@ -36,7 +36,7 @@ static constexpr i32 lookup_server_endpoint_magic = 9001;
|
||||
|
||||
// Get service entry buffers and file information for the getservent() family of functions.
|
||||
static FILE* services_file = nullptr;
|
||||
static const char* services_path = "/etc/services";
|
||||
static constexpr char services_path[] = "/etc/services";
|
||||
|
||||
static bool fill_getserv_buffers(const char* line, ssize_t read);
|
||||
static servent __getserv_buffer;
|
||||
@ -50,7 +50,7 @@ static ssize_t service_file_offset = 0;
|
||||
|
||||
// Get protocol entry buffers and file information for the getprotent() family of functions.
|
||||
static FILE* protocols_file = nullptr;
|
||||
static const char* protocols_path = "/etc/protocols";
|
||||
static constexpr char protocols_path[] = "/etc/protocols";
|
||||
|
||||
static bool fill_getproto_buffers(const char* line, ssize_t read);
|
||||
static protoent __getproto_buffer;
|
||||
|
@ -70,10 +70,9 @@ char* ctime_r(const time_t* t, char* buf)
|
||||
return asctime_r(localtime_r(t, &tm_buf), buf);
|
||||
}
|
||||
|
||||
static const int __seconds_per_day = 60 * 60 * 24;
|
||||
|
||||
static void time_to_tm(struct tm* tm, time_t t)
|
||||
{
|
||||
constexpr int __seconds_per_day = 60 * 60 * 24;
|
||||
int year = 1970;
|
||||
for (; t >= days_in_year(year) * __seconds_per_day; ++year)
|
||||
t -= days_in_year(year) * __seconds_per_day;
|
||||
|
@ -5,6 +5,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibGUI/Calendar.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
@ -16,21 +17,21 @@ REGISTER_WIDGET(GUI, Calendar);
|
||||
|
||||
namespace GUI {
|
||||
|
||||
static const char* long_day_names[] = {
|
||||
static constexpr Array long_day_names = {
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday",
|
||||
"Thursday", "Friday", "Saturday"
|
||||
};
|
||||
|
||||
static const char* short_day_names[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
|
||||
static const char* mini_day_names[] = { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" };
|
||||
static const char* micro_day_names[] = { "S", "M", "T", "W", "T", "F", "S" };
|
||||
static constexpr Array short_day_names = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
|
||||
static constexpr Array mini_day_names = { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" };
|
||||
static constexpr Array micro_day_names = { "S", "M", "T", "W", "T", "F", "S" };
|
||||
|
||||
static const char* long_month_names[] = {
|
||||
static constexpr Array long_month_names = {
|
||||
"January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December"
|
||||
};
|
||||
|
||||
static const char* short_month_names[] = {
|
||||
static constexpr Array short_month_names = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
@ -15,9 +15,9 @@ REGISTER_WIDGET(GUI, CheckBox)
|
||||
|
||||
namespace GUI {
|
||||
|
||||
static const int s_box_width = 13;
|
||||
static const int s_box_height = 13;
|
||||
static const int s_horizontal_padding = 6;
|
||||
static constexpr int s_box_width = 13;
|
||||
static constexpr int s_box_height = 13;
|
||||
static constexpr int s_horizontal_padding = 6;
|
||||
|
||||
CheckBox::CheckBox(String text)
|
||||
: AbstractButton(move(text))
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
namespace GUI {
|
||||
|
||||
static const char* s_arrow_bitmap_data = {
|
||||
static constexpr char s_arrow_bitmap_data[] = {
|
||||
" "
|
||||
" # "
|
||||
" ## "
|
||||
@ -24,8 +24,8 @@ static const char* s_arrow_bitmap_data = {
|
||||
" # "
|
||||
" "
|
||||
};
|
||||
static const int s_arrow_bitmap_width = 9;
|
||||
static const int s_arrow_bitmap_height = 9;
|
||||
static constexpr int s_arrow_bitmap_width = 9;
|
||||
static constexpr int s_arrow_bitmap_height = 9;
|
||||
|
||||
ColumnsView::ColumnsView()
|
||||
{
|
||||
|
@ -169,7 +169,10 @@ Icon FileIconProvider::icon_for_executable(const String& path)
|
||||
int image_size;
|
||||
};
|
||||
|
||||
static const IconSection icon_sections[] = { { .section_name = "serenity_icon_s", .image_size = 16 }, { .section_name = "serenity_icon_m", .image_size = 32 } };
|
||||
constexpr Array icon_sections = {
|
||||
IconSection { .section_name = "serenity_icon_s", .image_size = 16 },
|
||||
IconSection { .section_name = "serenity_icon_m", .image_size = 32 }
|
||||
};
|
||||
|
||||
bool had_error = false;
|
||||
for (const auto& icon_section : icon_sections) {
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace GUI {
|
||||
|
||||
static const char* s_resize_corner_shadows_data = {
|
||||
static constexpr char s_resize_corner_shadows_data[] = {
|
||||
" "
|
||||
" ## "
|
||||
" # "
|
||||
@ -31,7 +31,7 @@ static const char* s_resize_corner_shadows_data = {
|
||||
" "
|
||||
};
|
||||
|
||||
static const char* s_resize_corner_highlights_data = {
|
||||
static constexpr char s_resize_corner_highlights_data[] = {
|
||||
" "
|
||||
" "
|
||||
" # "
|
||||
@ -52,8 +52,8 @@ static const char* s_resize_corner_highlights_data = {
|
||||
|
||||
static Gfx::CharacterBitmap* s_resize_corner_shadows_bitmap;
|
||||
static Gfx::CharacterBitmap* s_resize_corner_highlights_bitmap;
|
||||
static const int s_resize_corner_bitmap_width = 16;
|
||||
static const int s_resize_corner_bitmap_height = 16;
|
||||
static constexpr int s_resize_corner_bitmap_width = 16;
|
||||
static constexpr int s_resize_corner_bitmap_height = 16;
|
||||
|
||||
ResizeCorner::ResizeCorner()
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ REGISTER_WIDGET(GUI, Scrollbar)
|
||||
|
||||
namespace GUI {
|
||||
|
||||
static const char* s_up_arrow_bitmap_data = {
|
||||
static constexpr char s_up_arrow_bitmap_data[] = {
|
||||
" "
|
||||
" # "
|
||||
" ### "
|
||||
@ -27,7 +27,7 @@ static const char* s_up_arrow_bitmap_data = {
|
||||
" "
|
||||
};
|
||||
|
||||
static const char* s_down_arrow_bitmap_data = {
|
||||
static constexpr char s_down_arrow_bitmap_data[] = {
|
||||
" "
|
||||
" ### "
|
||||
" ### "
|
||||
@ -39,7 +39,7 @@ static const char* s_down_arrow_bitmap_data = {
|
||||
" "
|
||||
};
|
||||
|
||||
static const char* s_left_arrow_bitmap_data = {
|
||||
static constexpr char s_left_arrow_bitmap_data[] = {
|
||||
" "
|
||||
" # "
|
||||
" ## "
|
||||
@ -51,7 +51,7 @@ static const char* s_left_arrow_bitmap_data = {
|
||||
" "
|
||||
};
|
||||
|
||||
static const char* s_right_arrow_bitmap_data = {
|
||||
static constexpr char s_right_arrow_bitmap_data[] = {
|
||||
" "
|
||||
" # "
|
||||
" ## "
|
||||
|
@ -354,7 +354,7 @@ void ClassicStylePainter::paint_radio_button(Painter& painter, const IntRect& re
|
||||
painter.blit(rect.location(), bitmap, bitmap.rect());
|
||||
}
|
||||
|
||||
static const char* s_checked_bitmap_data = {
|
||||
static constexpr char s_checked_bitmap_data[] = {
|
||||
" "
|
||||
" # "
|
||||
" ## "
|
||||
@ -367,8 +367,8 @@ static const char* s_checked_bitmap_data = {
|
||||
};
|
||||
|
||||
static Gfx::CharacterBitmap* s_checked_bitmap;
|
||||
static const int s_checked_bitmap_width = 9;
|
||||
static const int s_checked_bitmap_height = 9;
|
||||
static constexpr int s_checked_bitmap_width = 9;
|
||||
static constexpr int s_checked_bitmap_height = 9;
|
||||
|
||||
void ClassicStylePainter::paint_check_box(Painter& painter, const IntRect& rect, const Palette& palette, bool is_enabled, bool is_checked, bool is_being_pressed)
|
||||
{
|
||||
|
@ -140,7 +140,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
constexpr Color interpolate(const Color& other, float weight) const
|
||||
Color interpolate(const Color& other, float weight) const
|
||||
{
|
||||
u8 r = red() + roundf(static_cast<float>(other.red() - red()) * weight);
|
||||
u8 g = green() + roundf(static_cast<float>(other.green() - green()) * weight);
|
||||
|
@ -19,10 +19,6 @@
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
// Row strides and offsets for each interlace pass.
|
||||
static const int INTERLACE_ROW_STRIDES[] = { 8, 8, 4, 2 };
|
||||
static const int INTERLACE_ROW_OFFSETS[] = { 0, 4, 2, 1 };
|
||||
|
||||
struct ImageDescriptor {
|
||||
u16 x { 0 };
|
||||
u16 y { 0 };
|
||||
@ -112,8 +108,8 @@ enum class GIFFormat {
|
||||
|
||||
static Optional<GIFFormat> decode_gif_header(InputMemoryStream& stream)
|
||||
{
|
||||
static const char valid_header_87[] = "GIF87a";
|
||||
static const char valid_header_89[] = "GIF89a";
|
||||
constexpr char valid_header_87[] = "GIF87a";
|
||||
constexpr char valid_header_89[] = "GIF89a";
|
||||
|
||||
Array<u8, 6> header;
|
||||
stream >> header;
|
||||
@ -378,6 +374,8 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index)
|
||||
if (pixel_index % image.width == 0) {
|
||||
if (image.interlaced) {
|
||||
if (interlace_pass < 4) {
|
||||
constexpr Array INTERLACE_ROW_STRIDES = { 8, 8, 4, 2 };
|
||||
constexpr Array INTERLACE_ROW_OFFSETS = { 0, 4, 2, 1 };
|
||||
if (row + INTERLACE_ROW_STRIDES[interlace_pass] >= image.height) {
|
||||
++interlace_pass;
|
||||
if (interlace_pass < 4)
|
||||
|
@ -861,20 +861,20 @@ static void dequantize(JPGLoadingContext& context, Vector<Macroblock>& macrobloc
|
||||
|
||||
static void inverse_dct(const JPGLoadingContext& context, Vector<Macroblock>& macroblocks)
|
||||
{
|
||||
static const float m0 = 2.0 * cos(1.0 / 16.0 * 2.0 * M_PI);
|
||||
static const float m1 = 2.0 * cos(2.0 / 16.0 * 2.0 * M_PI);
|
||||
static const float m3 = 2.0 * cos(2.0 / 16.0 * 2.0 * M_PI);
|
||||
static const float m5 = 2.0 * cos(3.0 / 16.0 * 2.0 * M_PI);
|
||||
static const float m2 = m0 - m5;
|
||||
static const float m4 = m0 + m5;
|
||||
static const float s0 = cos(0.0 / 16.0 * M_PI) / sqrt(8);
|
||||
static const float s1 = cos(1.0 / 16.0 * M_PI) / 2.0;
|
||||
static const float s2 = cos(2.0 / 16.0 * M_PI) / 2.0;
|
||||
static const float s3 = cos(3.0 / 16.0 * M_PI) / 2.0;
|
||||
static const float s4 = cos(4.0 / 16.0 * M_PI) / 2.0;
|
||||
static const float s5 = cos(5.0 / 16.0 * M_PI) / 2.0;
|
||||
static const float s6 = cos(6.0 / 16.0 * M_PI) / 2.0;
|
||||
static const float s7 = cos(7.0 / 16.0 * M_PI) / 2.0;
|
||||
const float m0 = 2.0 * cos(1.0 / 16.0 * 2.0 * M_PI);
|
||||
const float m1 = 2.0 * cos(2.0 / 16.0 * 2.0 * M_PI);
|
||||
const float m3 = 2.0 * cos(2.0 / 16.0 * 2.0 * M_PI);
|
||||
const float m5 = 2.0 * cos(3.0 / 16.0 * 2.0 * M_PI);
|
||||
const float m2 = m0 - m5;
|
||||
const float m4 = m0 + m5;
|
||||
const float s0 = cos(0.0 / 16.0 * M_PI) / sqrt(8);
|
||||
const float s1 = cos(1.0 / 16.0 * M_PI) / 2.0;
|
||||
const float s2 = cos(2.0 / 16.0 * M_PI) / 2.0;
|
||||
const float s3 = cos(3.0 / 16.0 * M_PI) / 2.0;
|
||||
const float s4 = cos(4.0 / 16.0 * M_PI) / 2.0;
|
||||
const float s5 = cos(5.0 / 16.0 * M_PI) / 2.0;
|
||||
const float s6 = cos(6.0 / 16.0 * M_PI) / 2.0;
|
||||
const float s7 = cos(7.0 / 16.0 * M_PI) / 2.0;
|
||||
|
||||
for (u32 vcursor = 0; vcursor < context.mblock_meta.vcount; vcursor += context.vsample_factor) {
|
||||
for (u32 hcursor = 0; hcursor < context.mblock_meta.hcount; hcursor += context.hsample_factor) {
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
static const u8 png_header[8] = { 0x89, 'P', 'N', 'G', 13, 10, 26, 10 };
|
||||
static constexpr Array png_header = { 0x89, 'P', 'N', 'G', 13, 10, 26, 10 };
|
||||
|
||||
struct PNG_IHDR {
|
||||
NetworkOrdered<u32> width;
|
||||
@ -512,7 +512,7 @@ static bool decode_png_header(PNGLoadingContext& context)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (memcmp(context.data, png_header, sizeof(png_header)) != 0) {
|
||||
if (memcmp(context.data, png_header.data(), sizeof(png_header)) != 0) {
|
||||
dbgln_if(PNG_DEBUG, "Invalid PNG header");
|
||||
context.state = PNGLoadingContext::State::Error;
|
||||
return false;
|
||||
@ -661,14 +661,14 @@ static int adam7_width(PNGLoadingContext& context, int pass)
|
||||
}
|
||||
}
|
||||
|
||||
// Index 0 unused (non-interlaced case)
|
||||
static int adam7_starty[8] = { 0, 0, 0, 4, 0, 2, 0, 1 };
|
||||
static int adam7_startx[8] = { 0, 0, 4, 0, 2, 0, 1, 0 };
|
||||
static int adam7_stepy[8] = { 1, 8, 8, 8, 4, 4, 2, 2 };
|
||||
static int adam7_stepx[8] = { 1, 8, 8, 4, 4, 2, 2, 1 };
|
||||
|
||||
static bool decode_adam7_pass(PNGLoadingContext& context, Streamer& streamer, int pass)
|
||||
{
|
||||
// Index 0 unused (non-interlaced case)
|
||||
constexpr Array adam7_starty = { 0, 0, 0, 4, 0, 2, 0, 1 };
|
||||
constexpr Array adam7_startx = { 0, 0, 4, 0, 2, 0, 1, 0 };
|
||||
constexpr Array adam7_stepy = { 1, 8, 8, 8, 4, 4, 2, 2 };
|
||||
constexpr Array adam7_stepx = { 1, 8, 8, 4, 4, 2, 2, 1 };
|
||||
|
||||
PNGLoadingContext subimage_context;
|
||||
subimage_context.width = adam7_width(context, pass);
|
||||
subimage_context.height = adam7_height(context, pass);
|
||||
|
@ -1476,7 +1476,7 @@ void do_draw_text(const IntRect& rect, const TextType& text, const Font& font, T
|
||||
lines.append(line);
|
||||
}
|
||||
|
||||
static const int line_spacing = 4;
|
||||
constexpr int line_spacing = 4;
|
||||
int line_height = font.glyph_height() + line_spacing;
|
||||
IntRect bounding_rect { 0, 0, 0, (static_cast<int>(lines.size()) * line_height) - line_spacing };
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibJS/Runtime/Error.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/NumberObject.h>
|
||||
@ -12,17 +13,6 @@
|
||||
|
||||
namespace JS {
|
||||
|
||||
static const u8 max_precision_for_radix[37] = {
|
||||
// clang-format off
|
||||
0, 0, 52, 32, 26, 22, 20, 18, 17, 16,
|
||||
15, 15, 14, 14, 13, 13, 13, 12, 12, 12,
|
||||
12, 11, 11, 11, 11, 11, 11, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
NumberPrototype::NumberPrototype(GlobalObject& global_object)
|
||||
: NumberObject(0, *global_object.object_prototype())
|
||||
{
|
||||
@ -41,6 +31,8 @@ NumberPrototype::~NumberPrototype()
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
|
||||
{
|
||||
constexpr StringView digits = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
Value number_value;
|
||||
|
||||
auto this_value = vm.this_value(global_object);
|
||||
@ -107,6 +99,14 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
|
||||
if (decimal_part != 0.0) {
|
||||
characters.append('.');
|
||||
|
||||
constexpr u8 max_precision_for_radix[37] = {
|
||||
// clang-format off
|
||||
0, 0, 52, 32, 26, 22, 20, 18, 17, 16,
|
||||
15, 15, 14, 14, 13, 13, 13, 12, 12, 12,
|
||||
12, 11, 11, 11, 11, 11, 11, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10,
|
||||
// clang-format on
|
||||
};
|
||||
u8 precision = max_precision_for_radix[radix];
|
||||
|
||||
for (u8 i = 0; i < precision; ++i) {
|
||||
|
@ -37,7 +37,7 @@
|
||||
namespace JS {
|
||||
|
||||
// Used in various abstract operations to make it obvious when a non-optional return value must be discarded.
|
||||
static const double INVALID { 0 };
|
||||
static constexpr double INVALID { 0 };
|
||||
|
||||
static inline bool same_type_for_equality(const Value& lhs, const Value& rhs)
|
||||
{
|
||||
|
@ -56,11 +56,11 @@ union FloatExtractor;
|
||||
// This assumes long double is 80 bits, which is true with GCC on Intel platforms
|
||||
template<>
|
||||
union FloatExtractor<long double> {
|
||||
static const int mantissa_bits = 64;
|
||||
static const unsigned long long mantissa_max = ~0u;
|
||||
static const int exponent_bias = 16383;
|
||||
static const int exponent_bits = 15;
|
||||
static const unsigned exponent_max = 32767;
|
||||
static constexpr int mantissa_bits = 64;
|
||||
static constexpr unsigned long long mantissa_max = ~0u;
|
||||
static constexpr int exponent_bias = 16383;
|
||||
static constexpr int exponent_bits = 15;
|
||||
static constexpr unsigned exponent_max = 32767;
|
||||
struct {
|
||||
unsigned long long mantissa;
|
||||
unsigned exponent : 15;
|
||||
@ -72,11 +72,11 @@ union FloatExtractor<long double> {
|
||||
|
||||
template<>
|
||||
union FloatExtractor<double> {
|
||||
static const int mantissa_bits = 52;
|
||||
static const unsigned long long mantissa_max = (1ull << 52) - 1;
|
||||
static const int exponent_bias = 1023;
|
||||
static const int exponent_bits = 11;
|
||||
static const unsigned exponent_max = 2047;
|
||||
static constexpr int mantissa_bits = 52;
|
||||
static constexpr unsigned long long mantissa_max = (1ull << 52) - 1;
|
||||
static constexpr int exponent_bias = 1023;
|
||||
static constexpr int exponent_bits = 11;
|
||||
static constexpr unsigned exponent_max = 2047;
|
||||
struct {
|
||||
unsigned long long mantissa : 52;
|
||||
unsigned exponent : 11;
|
||||
@ -87,11 +87,11 @@ union FloatExtractor<double> {
|
||||
|
||||
template<>
|
||||
union FloatExtractor<float> {
|
||||
static const int mantissa_bits = 23;
|
||||
static const unsigned mantissa_max = (1 << 23) - 1;
|
||||
static const int exponent_bias = 127;
|
||||
static const int exponent_bits = 8;
|
||||
static const unsigned exponent_max = 255;
|
||||
static constexpr int mantissa_bits = 23;
|
||||
static constexpr unsigned mantissa_max = (1 << 23) - 1;
|
||||
static constexpr int exponent_bias = 127;
|
||||
static constexpr int exponent_bits = 8;
|
||||
static constexpr unsigned exponent_max = 255;
|
||||
struct {
|
||||
unsigned long long mantissa : 23;
|
||||
unsigned exponent : 8;
|
||||
|
@ -6,25 +6,24 @@
|
||||
|
||||
#include <LibC/bits/pthread_forward.h>
|
||||
|
||||
static const PthreadFunctions s_functions = {
|
||||
.pthread_mutex_trylock = pthread_mutex_trylock,
|
||||
.pthread_mutex_destroy = pthread_mutex_destroy,
|
||||
|
||||
.pthread_mutexattr_init = pthread_mutexattr_init,
|
||||
.pthread_mutexattr_settype = pthread_mutexattr_settype,
|
||||
.pthread_mutexattr_destroy = pthread_mutexattr_destroy,
|
||||
|
||||
.pthread_once = pthread_once,
|
||||
|
||||
.pthread_cond_broadcast = pthread_cond_broadcast,
|
||||
.pthread_cond_init = pthread_cond_init,
|
||||
.pthread_cond_signal = pthread_cond_signal,
|
||||
.pthread_cond_wait = pthread_cond_wait,
|
||||
.pthread_cond_destroy = pthread_cond_destroy,
|
||||
.pthread_cond_timedwait = pthread_cond_timedwait,
|
||||
};
|
||||
|
||||
[[gnu::constructor]] static void forward_pthread_functions()
|
||||
{
|
||||
constexpr PthreadFunctions s_functions = {
|
||||
.pthread_mutex_trylock = pthread_mutex_trylock,
|
||||
.pthread_mutex_destroy = pthread_mutex_destroy,
|
||||
|
||||
.pthread_mutexattr_init = pthread_mutexattr_init,
|
||||
.pthread_mutexattr_settype = pthread_mutexattr_settype,
|
||||
.pthread_mutexattr_destroy = pthread_mutexattr_destroy,
|
||||
|
||||
.pthread_once = pthread_once,
|
||||
|
||||
.pthread_cond_broadcast = pthread_cond_broadcast,
|
||||
.pthread_cond_init = pthread_cond_init,
|
||||
.pthread_cond_signal = pthread_cond_signal,
|
||||
.pthread_cond_wait = pthread_cond_wait,
|
||||
.pthread_cond_destroy = pthread_cond_destroy,
|
||||
.pthread_cond_timedwait = pthread_cond_timedwait,
|
||||
};
|
||||
__init_pthread_forward(s_functions);
|
||||
}
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
namespace regex {
|
||||
|
||||
static const constexpr size_t c_max_recursion = 5000;
|
||||
static const constexpr size_t c_match_preallocation_count = 0;
|
||||
static constexpr size_t c_max_recursion = 5000;
|
||||
static constexpr size_t c_match_preallocation_count = 0;
|
||||
|
||||
struct RegexResult final {
|
||||
bool success { false };
|
||||
|
@ -16,8 +16,8 @@ namespace VT {
|
||||
struct Attribute {
|
||||
Attribute() { reset(); }
|
||||
|
||||
static const u32 default_foreground_color = xterm_colors[7];
|
||||
static const u32 default_background_color = xterm_colors[0];
|
||||
static constexpr u32 default_foreground_color = xterm_colors[7];
|
||||
static constexpr u32 default_background_color = xterm_colors[0];
|
||||
|
||||
void reset()
|
||||
{
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "ParsedCookie.h"
|
||||
#include <AK/Array.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibIPC/Decoder.h>
|
||||
@ -264,7 +265,7 @@ Optional<Core::DateTime> parse_date_time(StringView date_string)
|
||||
};
|
||||
|
||||
auto parse_month = [&](StringView token) {
|
||||
static const char* months[] { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" };
|
||||
constexpr Array months { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" };
|
||||
|
||||
for (unsigned i = 0; i < 12; ++i) {
|
||||
if (token.equals_ignoring_case(months[i])) {
|
||||
|
@ -100,7 +100,7 @@ static void build(InstructionDescriptor* table, u8 op, const char* mnemonic, Ins
|
||||
case OP_AX_moff16:
|
||||
case OP_EAX_moff32:
|
||||
case OP_NEAR_imm:
|
||||
d.imm1_bytes = CurrentAddressSize;
|
||||
d.imm1_bytes = InstructionDescriptor::CurrentAddressSize;
|
||||
break;
|
||||
//default:
|
||||
case InvalidFormat:
|
||||
|
@ -28,9 +28,9 @@ protected:
|
||||
|
||||
template<typename T>
|
||||
struct TypeTrivia {
|
||||
static const size_t bits = sizeof(T) * 8;
|
||||
static const T sign_bit = 1 << (bits - 1);
|
||||
static const T mask = MakeUnsigned<T>(-1);
|
||||
static constexpr size_t bits = sizeof(T) * 8;
|
||||
static constexpr T sign_bit = 1 << (bits - 1);
|
||||
static constexpr T mask = MakeUnsigned<T>(-1);
|
||||
};
|
||||
|
||||
template<typename T, typename U>
|
||||
@ -159,9 +159,9 @@ enum InstructionFormat {
|
||||
OP_NEAR_imm,
|
||||
};
|
||||
|
||||
static const unsigned CurrentAddressSize = 0xB33FBABE;
|
||||
|
||||
struct InstructionDescriptor {
|
||||
static constexpr unsigned CurrentAddressSize = 0xB33FBABE;
|
||||
|
||||
InstructionHandler handler { nullptr };
|
||||
bool opcode_has_register_index { false };
|
||||
const char* mnemonic { nullptr };
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "ShutdownDialog.h"
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
@ -17,7 +17,7 @@
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
|
||||
struct Option {
|
||||
String title;
|
||||
StringView title;
|
||||
Vector<char const*> cmd;
|
||||
bool enabled;
|
||||
bool default_action;
|
||||
|
@ -634,7 +634,7 @@ void Compositor::flip_buffers()
|
||||
|
||||
void Compositor::run_animations(Gfx::DisjointRectSet& flush_rects)
|
||||
{
|
||||
static const int minimize_animation_steps = 10;
|
||||
constexpr int minimize_animation_steps = 10;
|
||||
auto& painter = *m_back_painter;
|
||||
Gfx::PainterStateSaver saver(painter);
|
||||
painter.set_draw_op(Gfx::Painter::DrawOp::Invert);
|
||||
|
@ -55,7 +55,7 @@ const Gfx::Font& Menu::font() const
|
||||
return Gfx::FontDatabase::default_font();
|
||||
}
|
||||
|
||||
static const char* s_checked_bitmap_data = {
|
||||
static constexpr char s_checked_bitmap_data[] = {
|
||||
" "
|
||||
" # "
|
||||
" ## "
|
||||
@ -67,7 +67,7 @@ static const char* s_checked_bitmap_data = {
|
||||
" "
|
||||
};
|
||||
|
||||
static const char* s_submenu_arrow_bitmap_data = {
|
||||
static constexpr char s_submenu_arrow_bitmap_data[] = {
|
||||
" "
|
||||
" # "
|
||||
" ## "
|
||||
@ -80,12 +80,12 @@ static const char* s_submenu_arrow_bitmap_data = {
|
||||
};
|
||||
|
||||
static Gfx::CharacterBitmap* s_checked_bitmap;
|
||||
static const int s_checked_bitmap_width = 9;
|
||||
static const int s_checked_bitmap_height = 9;
|
||||
static const int s_submenu_arrow_bitmap_width = 9;
|
||||
static const int s_submenu_arrow_bitmap_height = 9;
|
||||
static const int s_item_icon_width = 16;
|
||||
static const int s_stripe_width = 24;
|
||||
static constexpr int s_checked_bitmap_width = 9;
|
||||
static constexpr int s_checked_bitmap_height = 9;
|
||||
static constexpr int s_submenu_arrow_bitmap_width = 9;
|
||||
static constexpr int s_submenu_arrow_bitmap_height = 9;
|
||||
static constexpr int s_item_icon_width = 16;
|
||||
static constexpr int s_stripe_width = 24;
|
||||
|
||||
int Menu::content_width() const
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ WindowManager::~WindowManager()
|
||||
|
||||
NonnullRefPtr<Cursor> WindowManager::get_cursor(const String& name)
|
||||
{
|
||||
static const auto s_default_cursor_path = "/res/cursors/arrow.x2y2.png";
|
||||
constexpr auto s_default_cursor_path = "/res/cursors/arrow.x2y2.png";
|
||||
auto path = m_config->read_entry("Cursor", name, s_default_cursor_path);
|
||||
auto gb = Gfx::Bitmap::load_from_file(path, compositor_icon_scale());
|
||||
if (gb)
|
||||
|
@ -42,9 +42,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static const int m_days_in_week = 5;
|
||||
static const int m_days_in_season = 73;
|
||||
static const int m_st_tibs_day_of_yold = 60;
|
||||
static constexpr int m_days_in_week = 5;
|
||||
static constexpr int m_days_in_season = 73;
|
||||
static constexpr int m_st_tibs_day_of_yold = 60;
|
||||
Core::DateTime m_gregorian_date;
|
||||
String m_day_of_week;
|
||||
String m_season;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibPCIDB/Database.h>
|
||||
@ -16,8 +17,8 @@
|
||||
|
||||
static bool flag_show_numerical = false;
|
||||
|
||||
static const char* format_numerical = "{:04x}:{:02x}:{:02x}.{} {}: {}:{} (rev {:02x})";
|
||||
static const char* format_textual = "{:04x}:{:02x}:{:02x}.{} {}: {} {} (rev {:02x})";
|
||||
static constexpr StringView format_numerical = "{:04x}:{:02x}:{:02x}.{} {}: {}:{} (rev {:02x})";
|
||||
static constexpr StringView format_textual = "{:04x}:{:02x}:{:02x}.{} {}: {} {} (rev {:02x})";
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
@ -43,7 +44,7 @@ int main(int argc, char** argv)
|
||||
args_parser.add_option(flag_show_numerical, "Show numerical IDs", "numerical", 'n');
|
||||
args_parser.parse(argc, argv);
|
||||
|
||||
const char* format = flag_show_numerical ? format_numerical : format_textual;
|
||||
const auto format = flag_show_numerical ? format_numerical : format_textual;
|
||||
|
||||
RefPtr<PCIDB::Database> db;
|
||||
if (!flag_show_numerical) {
|
||||
|
Loading…
Reference in New Issue
Block a user