summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-09-05 18:29:11 -0400
committerLinus Groh <mail@linusgroh.de>2021-09-06 15:24:27 +0100
commit40ea6592828e28c9a562adb546f1713eb751b6bf (patch)
treef94c3112fe2cb73f46789c915a2c73f012aa86c2
parent50158abaf196e23e5996646bfc1b42f8ca0d3764 (diff)
downloadserenity-40ea6592828e28c9a562adb546f1713eb751b6bf.zip
LibUnicode+LibJS: Return removed extensions from remove_extension_type
Some callers will need to hold onto the removed extensions.
-rw-r--r--Userland/Libraries/LibUnicode/Locale.h9
1 files 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<typename ExtensionType>
- void remove_extension_type()
+ Vector<Extension> remove_extension_type()
{
+ Vector<Extension> removed_extensions {};
auto tmp_extensions = move(extensions);
for (auto& extension : tmp_extensions) {
- if (!extension.has<ExtensionType>())
+ if (extension.has<ExtensionType>())
+ removed_extensions.append(move(extension));
+ else
extensions.append(move(extension));
}
+
+ return removed_extensions;
}
LanguageID language_id {};