AK+Everywhere: Add and use static APIs for LexicalPath

The LexicalPath instance methods dirname(), basename(), title() and
extension() will be changed to return StringView const& in a further
commit. Due to this, users creating temporary LexicalPath objects just
to call one of those getters will recieve a StringView const& pointing
to a possible freed buffer.

To avoid this, static methods for those APIs have been added, which will
return a String by value to avoid those problems. All cases where
temporary LexicalPath objects have been used as described above haven
been changed to use the static APIs.
This commit is contained in:
Max Wipfli 2021-06-29 16:46:16 +02:00 committed by Andreas Kling
parent 9b8f35259c
commit fc6d051dfd
Notes: sideshowbarker 2024-07-18 11:13:39 +09:00
43 changed files with 80 additions and 56 deletions

View file

@ -56,7 +56,7 @@ int main(int argc, char** argv)
{
g_test_argc = argc;
g_test_argv = argv;
auto program_name = LexicalPath { argv[0] }.basename();
auto program_name = LexicalPath::basename(argv[0]);
g_program_name = program_name;
struct sigaction act;