diff --git a/Kernel/Interrupts/APIC.cpp b/Kernel/Interrupts/APIC.cpp index 758ba5cd37..f75963f829 100644 --- a/Kernel/Interrupts/APIC.cpp +++ b/Kernel/Interrupts/APIC.cpp @@ -81,7 +81,7 @@ public: virtual HandlerType type() const override { return HandlerType::IRQHandler; } virtual StringView purpose() const override { return "IPI Handler"sv; } - virtual StringView controller() const override { return nullptr; } + virtual StringView controller() const override { return {}; } virtual size_t sharing_devices_count() const override { return 0; } virtual bool is_shared_handler() const override { return false; } @@ -112,7 +112,7 @@ public: virtual HandlerType type() const override { return HandlerType::IRQHandler; } virtual StringView purpose() const override { return "SMP Error Handler"sv; } - virtual StringView controller() const override { return nullptr; } + virtual StringView controller() const override { return {}; } virtual size_t sharing_devices_count() const override { return 0; } virtual bool is_shared_handler() const override { return false; } diff --git a/Kernel/PerformanceEventBuffer.cpp b/Kernel/PerformanceEventBuffer.cpp index 50ee253202..b5171daa47 100644 --- a/Kernel/PerformanceEventBuffer.cpp +++ b/Kernel/PerformanceEventBuffer.cpp @@ -348,7 +348,7 @@ ErrorOr PerformanceEventBuffer::add_process(Process const& process, Proces ErrorOr result; process.for_each_thread([&](auto& thread) { result = append_with_ip_and_bp(process.pid(), thread.tid().value(), - 0, 0, PERF_EVENT_THREAD_CREATE, 0, 0, 0, nullptr); + 0, 0, PERF_EVENT_THREAD_CREATE, 0, 0, 0, {}); return result.is_error() ? IterationDecision::Break : IterationDecision::Continue; }); TRY(result); diff --git a/Kernel/PerformanceManager.h b/Kernel/PerformanceManager.h index fb909c8522..d56fbc98dd 100644 --- a/Kernel/PerformanceManager.h +++ b/Kernel/PerformanceManager.h @@ -34,7 +34,7 @@ public: if (g_profiling_all_threads) { VERIFY(g_global_perf_events); [[maybe_unused]] auto rc = g_global_perf_events->append_with_ip_and_bp( - process.pid(), 0, 0, 0, PERF_EVENT_PROCESS_EXIT, 0, 0, 0, nullptr); + process.pid(), 0, 0, 0, PERF_EVENT_PROCESS_EXIT, 0, 0, 0, {}); } } @@ -43,7 +43,7 @@ public: if (thread.is_profiling_suppressed()) return; if (auto* event_buffer = thread.process().current_perf_events_buffer()) { - [[maybe_unused]] auto rc = event_buffer->append(PERF_EVENT_THREAD_CREATE, thread.tid().value(), 0, nullptr, &thread); + [[maybe_unused]] auto rc = event_buffer->append(PERF_EVENT_THREAD_CREATE, thread.tid().value(), 0, {}, &thread); } } @@ -52,7 +52,7 @@ public: // As an exception this doesn't check whether profiling is suppressed for // the thread so we can record the thread_exit event anyway. if (auto* event_buffer = thread.process().current_perf_events_buffer()) { - [[maybe_unused]] auto rc = event_buffer->append(PERF_EVENT_THREAD_EXIT, thread.tid().value(), 0, nullptr, &thread); + [[maybe_unused]] auto rc = event_buffer->append(PERF_EVENT_THREAD_EXIT, thread.tid().value(), 0, {}, &thread); } } @@ -62,7 +62,7 @@ public: return; if (auto* event_buffer = current_thread.process().current_perf_events_buffer()) { [[maybe_unused]] auto rc = event_buffer->append_with_ip_and_bp( - current_thread.pid(), current_thread.tid(), regs, PERF_EVENT_SAMPLE, lost_time, 0, 0, nullptr); + current_thread.pid(), current_thread.tid(), regs, PERF_EVENT_SAMPLE, lost_time, 0, 0, {}); } } @@ -76,7 +76,7 @@ public: inline static void add_unmap_perf_event(Process& current_process, Memory::VirtualRange const& region) { if (auto* event_buffer = current_process.current_perf_events_buffer()) { - [[maybe_unused]] auto res = event_buffer->append(PERF_EVENT_MUNMAP, region.base().get(), region.size(), nullptr); + [[maybe_unused]] auto res = event_buffer->append(PERF_EVENT_MUNMAP, region.base().get(), region.size(), {}); } } @@ -85,7 +85,7 @@ public: if (current_thread.is_profiling_suppressed()) return; if (auto* event_buffer = current_thread.process().current_perf_events_buffer()) { - [[maybe_unused]] auto res = event_buffer->append(PERF_EVENT_CONTEXT_SWITCH, next_thread.pid().value(), next_thread.tid().value(), nullptr); + [[maybe_unused]] auto res = event_buffer->append(PERF_EVENT_CONTEXT_SWITCH, next_thread.pid().value(), next_thread.tid().value(), {}); } } @@ -94,7 +94,7 @@ public: if (current_thread.is_profiling_suppressed()) return; if (auto* event_buffer = current_thread.process().current_perf_events_buffer()) { - [[maybe_unused]] auto res = event_buffer->append(PERF_EVENT_KMALLOC, size, ptr, nullptr); + [[maybe_unused]] auto res = event_buffer->append(PERF_EVENT_KMALLOC, size, ptr, {}); } } @@ -103,7 +103,7 @@ public: if (current_thread.is_profiling_suppressed()) return; if (auto* event_buffer = current_thread.process().current_perf_events_buffer()) { - [[maybe_unused]] auto res = event_buffer->append(PERF_EVENT_KFREE, size, ptr, nullptr); + [[maybe_unused]] auto res = event_buffer->append(PERF_EVENT_KFREE, size, ptr, {}); } } @@ -113,7 +113,7 @@ public: return; if (auto* event_buffer = thread.process().current_perf_events_buffer()) { [[maybe_unused]] auto rc = event_buffer->append_with_ip_and_bp( - thread.pid(), thread.tid(), regs, PERF_EVENT_PAGE_FAULT, 0, 0, 0, nullptr); + thread.pid(), thread.tid(), regs, PERF_EVENT_PAGE_FAULT, 0, 0, 0, {}); } } @@ -123,7 +123,7 @@ public: return; if (auto* event_buffer = thread.process().current_perf_events_buffer()) { [[maybe_unused]] auto rc = event_buffer->append_with_ip_and_bp( - thread.pid(), thread.tid(), regs, PERF_EVENT_SYSCALL, 0, 0, 0, nullptr); + thread.pid(), thread.tid(), regs, PERF_EVENT_SYSCALL, 0, 0, 0, {}); } } @@ -158,7 +158,7 @@ public: filepath_string_index = registered_result.value(); } - [[maybe_unused]] auto rc = event_buffer->append(PERF_EVENT_READ, fd, size, 0, &thread, filepath_string_index, start_timestamp, result); // wrong arguments + [[maybe_unused]] auto rc = event_buffer->append(PERF_EVENT_READ, fd, size, {}, &thread, filepath_string_index, start_timestamp, result); // wrong arguments } inline static void timer_tick(RegisterState const& regs) diff --git a/Kernel/Syscalls/perf_event.cpp b/Kernel/Syscalls/perf_event.cpp index 8f6bb91936..f7da35d5d9 100644 --- a/Kernel/Syscalls/perf_event.cpp +++ b/Kernel/Syscalls/perf_event.cpp @@ -15,7 +15,7 @@ ErrorOr Process::sys$perf_event(int type, FlatPtr arg1, FlatPtr arg2) auto* events_buffer = current_perf_events_buffer(); if (!events_buffer) return 0; - TRY(events_buffer->append(type, arg1, arg2, nullptr)); + TRY(events_buffer->append(type, arg1, arg2, {})); return 0; } diff --git a/Kernel/Time/HardwareTimer.h b/Kernel/Time/HardwareTimer.h index 96643e820b..ed1e0851ec 100644 --- a/Kernel/Time/HardwareTimer.h +++ b/Kernel/Time/HardwareTimer.h @@ -133,7 +133,7 @@ public: virtual bool is_shared_handler() const override { return false; } virtual bool is_sharing_with_others() const override { return false; } virtual HandlerType type() const override { return HandlerType::IRQHandler; } - virtual StringView controller() const override { return nullptr; } + virtual StringView controller() const override { return {}; } virtual bool eoi() override; virtual u32 frequency() const override { return (u32)m_frequency; } diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp index 770b9f2735..e1321c8a9c 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp @@ -32,8 +32,8 @@ void generate_iterator_implementation(IDL::Interface const&); int main(int argc, char** argv) { Core::ArgsParser args_parser; - StringView path = nullptr; - StringView import_base_path = nullptr; + StringView path; + StringView import_base_path; bool header_mode = false; bool implementation_mode = false; bool constructor_header_mode = false; diff --git a/Userland/Libraries/LibELF/Image.cpp b/Userland/Libraries/LibELF/Image.cpp index d5d81b23e4..6a32c3a82f 100644 --- a/Userland/Libraries/LibELF/Image.cpp +++ b/Userland/Libraries/LibELF/Image.cpp @@ -163,7 +163,7 @@ StringView Image::table_string(unsigned table_index, unsigned offset) const VERIFY(m_valid); auto& sh = section_header(table_index); if (sh.sh_type != SHT_STRTAB) - return nullptr; + return {}; size_t computed_offset = sh.sh_offset + offset; if (computed_offset >= m_size) { if (m_verbose_logging) diff --git a/Userland/Libraries/LibJS/Lexer.cpp b/Userland/Libraries/LibJS/Lexer.cpp index d7b24d9bfb..17dec6c963 100644 --- a/Userland/Libraries/LibJS/Lexer.cpp +++ b/Userland/Libraries/LibJS/Lexer.cpp @@ -23,7 +23,7 @@ HashMap Lexer::s_single_char_tokens; Lexer::Lexer(StringView source, StringView filename, size_t line_number, size_t line_column) : m_source(source) - , m_current_token(TokenType::Eof, {}, StringView(nullptr), StringView(nullptr), filename, 0, 0, 0) + , m_current_token(TokenType::Eof, {}, {}, {}, filename, 0, 0, 0) , m_filename(filename) , m_line_number(line_number) , m_line_column(line_column) diff --git a/Userland/Libraries/LibRegex/RegexByteCode.cpp b/Userland/Libraries/LibRegex/RegexByteCode.cpp index be5f5a8533..f40d1c25d2 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.cpp +++ b/Userland/Libraries/LibRegex/RegexByteCode.cpp @@ -855,7 +855,7 @@ Vector OpCode_Compare::variable_arguments_to_string(Optional Vector result; size_t offset { state().instruction_position + 3 }; - RegexStringView view = ((input.has_value()) ? input.value().view : nullptr); + RegexStringView view = ((input.has_value()) ? input.value().view : StringView {}); for (size_t i = 0; i < arguments_count(); ++i) { auto compare_type = (CharacterCompareType)m_bytecode->at(offset++); diff --git a/Userland/Libraries/LibRegex/RegexLexer.cpp b/Userland/Libraries/LibRegex/RegexLexer.cpp index 671e2cb4fa..b294271688 100644 --- a/Userland/Libraries/LibRegex/RegexLexer.cpp +++ b/Userland/Libraries/LibRegex/RegexLexer.cpp @@ -32,7 +32,7 @@ char const* Token::name() const } Lexer::Lexer() - : GenericLexer(StringView { nullptr }) + : GenericLexer(StringView {}) { } @@ -62,7 +62,7 @@ char Lexer::consume() void Lexer::reset() { m_index = 0; - m_current_token = { TokenType::Eof, 0, StringView(nullptr) }; + m_current_token = { TokenType::Eof, 0, {} }; m_previous_position = 0; } @@ -178,7 +178,7 @@ Token Lexer::next() return emit_token(TokenType::Char); } - return Token(TokenType::Eof, m_index, nullptr); + return Token(TokenType::Eof, m_index, {}); } } diff --git a/Userland/Libraries/LibRegex/RegexLexer.h b/Userland/Libraries/LibRegex/RegexLexer.h index 0c42759069..01c086b2c3 100644 --- a/Userland/Libraries/LibRegex/RegexLexer.h +++ b/Userland/Libraries/LibRegex/RegexLexer.h @@ -61,7 +61,7 @@ public: private: TokenType m_type { TokenType::Eof }; size_t m_position { 0 }; - StringView m_value { nullptr }; + StringView m_value {}; }; class Lexer : public GenericLexer { @@ -77,7 +77,7 @@ public: private: size_t m_previous_position { 0 }; - Token m_current_token { TokenType::Eof, 0, StringView(nullptr) }; + Token m_current_token { TokenType::Eof, 0, {} }; }; } diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp index 9ffec9f0a2..bef0ea344b 100644 --- a/Userland/Libraries/LibRegex/RegexParser.cpp +++ b/Userland/Libraries/LibRegex/RegexParser.cpp @@ -169,7 +169,7 @@ ALWAYS_INLINE void Parser::reset() m_parser_state.lexer.reset(); m_parser_state.current_token = m_parser_state.lexer.next(); m_parser_state.error = Error::NoError; - m_parser_state.error_token = { TokenType::Eof, 0, StringView(nullptr) }; + m_parser_state.error_token = { TokenType::Eof, 0, {} }; m_parser_state.capture_group_minimum_lengths.clear(); m_parser_state.capture_groups_count = 0; m_parser_state.named_capture_groups_count = 0; diff --git a/Userland/Libraries/LibRegex/RegexParser.h b/Userland/Libraries/LibRegex/RegexParser.h index 3610d3c72a..01f7fae268 100644 --- a/Userland/Libraries/LibRegex/RegexParser.h +++ b/Userland/Libraries/LibRegex/RegexParser.h @@ -101,7 +101,7 @@ protected: Lexer& lexer; Token current_token; Error error = Error::NoError; - Token error_token { TokenType::Eof, 0, StringView(nullptr) }; + Token error_token { TokenType::Eof, 0, {} }; ByteCode bytecode; size_t capture_groups_count { 0 }; size_t named_capture_groups_count { 0 }; diff --git a/Userland/Libraries/LibThreading/Thread.h b/Userland/Libraries/LibThreading/Thread.h index ab9c18b365..612403846d 100644 --- a/Userland/Libraries/LibThreading/Thread.h +++ b/Userland/Libraries/LibThreading/Thread.h @@ -34,7 +34,7 @@ public: pthread_t tid() const { return m_tid; } private: - explicit Thread(Function action, StringView thread_name = nullptr); + explicit Thread(Function action, StringView thread_name = {}); Function m_action; pthread_t m_tid { 0 }; String m_thread_name; diff --git a/Userland/Utilities/paste.cpp b/Userland/Utilities/paste.cpp index c453ac4e49..ba0926525d 100644 --- a/Userland/Utilities/paste.cpp +++ b/Userland/Utilities/paste.cpp @@ -67,7 +67,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto& clipboard = GUI::Clipboard::the(); if (watch) { - watch_command.append(nullptr); + watch_command.append({}); clipboard.on_change = [&](String const&) { // Technically there's a race here... diff --git a/Userland/Utilities/test.cpp b/Userland/Utilities/test.cpp index 10af9e6b0d..c05a27d6de 100644 --- a/Userland/Utilities/test.cpp +++ b/Userland/Utilities/test.cpp @@ -516,7 +516,7 @@ ErrorOr serenity_main(Main::Arguments arguments) --argc; if (StringView { arguments.strings[argc] } != "]") fatal_error("test invoked as '[' requires a closing bracket ']'"); - arguments.strings[argc] = nullptr; + arguments.strings[argc] = {}; } // Exit false when no arguments are given.