From 40ea6592828e28c9a562adb546f1713eb751b6bf Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sun, 5 Sep 2021 18:29:11 -0400 Subject: [PATCH] LibUnicode+LibJS: Return removed extensions from remove_extension_type Some callers will need to hold onto the removed extensions. --- Userland/Libraries/LibUnicode/Locale.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibUnicode/Locale.h b/Userland/Libraries/LibUnicode/Locale.h index 3192052996..0a388fd16e 100644 --- a/Userland/Libraries/LibUnicode/Locale.h +++ b/Userland/Libraries/LibUnicode/Locale.h @@ -58,14 +58,19 @@ struct LocaleID { String to_string() const; template - void remove_extension_type() + Vector remove_extension_type() { + Vector removed_extensions {}; auto tmp_extensions = move(extensions); for (auto& extension : tmp_extensions) { - if (!extension.has()) + if (extension.has()) + removed_extensions.append(move(extension)); + else extensions.append(move(extension)); } + + return removed_extensions; } LanguageID language_id {};