mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Ladybird: Return a reference to the mach server name
Rather than a copy, return a reference so that it's a bit safer to use the result as a StringView within the calling scope.
This commit is contained in:
parent
c7ef8530bf
commit
278fc8e57f
Notes:
sideshowbarker
2024-07-17 04:01:41 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/278fc8e57f Pull-request: https://github.com/SerenityOS/serenity/pull/24074 Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 7 additions and 3 deletions
|
@ -26,10 +26,14 @@ constexpr auto libexec_path = "libexec"sv;
|
|||
ByteString s_serenity_resource_root;
|
||||
|
||||
Optional<ByteString> s_mach_server_name;
|
||||
Optional<ByteString> mach_server_name()
|
||||
|
||||
Optional<ByteString const&> mach_server_name()
|
||||
{
|
||||
return s_mach_server_name;
|
||||
if (s_mach_server_name.has_value())
|
||||
return *s_mach_server_name;
|
||||
return {};
|
||||
}
|
||||
|
||||
void set_mach_server_name(ByteString name)
|
||||
{
|
||||
s_mach_server_name = move(name);
|
||||
|
|
|
@ -17,5 +17,5 @@ ErrorOr<ByteString> application_directory();
|
|||
ErrorOr<Vector<ByteString>> get_paths_for_helper_process(StringView process_name);
|
||||
|
||||
extern ByteString s_serenity_resource_root;
|
||||
Optional<ByteString> mach_server_name();
|
||||
Optional<ByteString const&> mach_server_name();
|
||||
void set_mach_server_name(ByteString name);
|
||||
|
|
Loading…
Reference in a new issue