summaryrefslogtreecommitdiff
path: root/core/extension
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2022-05-13 15:04:37 +0200
committerRĂ©mi Verschelde <rverschelde@gmail.com>2022-05-16 10:37:48 +0200
commit746dddc0673d7261f19b1e056e90e6e3a49ef33a (patch)
tree434b526eb286850ebccc6d2c998a7d90fdb8b5e2 /core/extension
parent396def9b66c476f7834604adb7136ca903ed01be (diff)
Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
Diffstat (limited to 'core/extension')
-rw-r--r--core/extension/extension_api_dump.cpp2
-rw-r--r--core/extension/native_extension.h2
-rw-r--r--core/extension/native_extension_manager.cpp4
-rw-r--r--core/extension/native_extension_manager.h2
4 files changed, 5 insertions, 5 deletions
diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp
index 4d5dc7958c..9e8addf8aa 100644
--- a/core/extension/extension_api_dump.cpp
+++ b/core/extension/extension_api_dump.cpp
@@ -334,7 +334,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
{
// Global enums and constants.
Array constants;
- Map<String, List<Pair<String, int>>> enum_list;
+ HashMap<String, List<Pair<String, int>>> enum_list;
for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
int value = CoreConstants::get_global_constant_value(i);
diff --git a/core/extension/native_extension.h b/core/extension/native_extension.h
index af5a474e79..8f106f753d 100644
--- a/core/extension/native_extension.h
+++ b/core/extension/native_extension.h
@@ -45,7 +45,7 @@ class NativeExtension : public Resource {
ObjectNativeExtension native_extension;
};
- Map<StringName, Extension> extension_classes;
+ HashMap<StringName, Extension> extension_classes;
static void _register_extension_class(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name, const char *p_parent_class_name, const GDNativeExtensionClassCreationInfo *p_extension_funcs);
static void _register_extension_class_method(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name, const GDNativeExtensionClassMethodInfo *p_method_info);
diff --git a/core/extension/native_extension_manager.cpp b/core/extension/native_extension_manager.cpp
index 5436f7d51e..186fcc44f6 100644
--- a/core/extension/native_extension_manager.cpp
+++ b/core/extension/native_extension_manager.cpp
@@ -90,9 +90,9 @@ Vector<String> NativeExtensionManager::get_loaded_extensions() const {
return ret;
}
Ref<NativeExtension> NativeExtensionManager::get_extension(const String &p_path) {
- Map<String, Ref<NativeExtension>>::Element *E = native_extension_map.find(p_path);
+ HashMap<String, Ref<NativeExtension>>::Iterator E = native_extension_map.find(p_path);
ERR_FAIL_COND_V(!E, Ref<NativeExtension>());
- return E->get();
+ return E->value;
}
void NativeExtensionManager::initialize_extensions(NativeExtension::InitializationLevel p_level) {
diff --git a/core/extension/native_extension_manager.h b/core/extension/native_extension_manager.h
index b8339e4817..5594f6c0de 100644
--- a/core/extension/native_extension_manager.h
+++ b/core/extension/native_extension_manager.h
@@ -37,7 +37,7 @@ class NativeExtensionManager : public Object {
GDCLASS(NativeExtensionManager, Object);
int32_t level = -1;
- Map<String, Ref<NativeExtension>> native_extension_map;
+ HashMap<String, Ref<NativeExtension>> native_extension_map;
static void _bind_methods();