diff options
| author | Juan Linietsky | 2014-05-14 01:22:15 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2014-05-14 01:22:15 -0300 |
| commit | b324ff7ea584676fcc3292808d7e7ea609982f8e (patch) | |
| tree | b80e9aa0b8f2926a398e25ef904f6229cb3e28dd /core/hash_map.h | |
| parent | 45a509282e912d85c46b40974a2deb926be5be42 (diff) | |
| download | godot-b324ff7ea584676fcc3292808d7e7ea609982f8e.tar.gz godot-b324ff7ea584676fcc3292808d7e7ea609982f8e.tar.zst godot-b324ff7ea584676fcc3292808d7e7ea609982f8e.zip | |
Diffstat (limited to 'core/hash_map.h')
| -rw-r--r-- | core/hash_map.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/core/hash_map.h b/core/hash_map.h index 02a6600c3..da8f03849 100644 --- a/core/hash_map.h +++ b/core/hash_map.h @@ -285,14 +285,12 @@ public: } void set( const Pair& p_pair ) { - + + Entry *e=NULL; if (!hash_table) make_hash_table(); // if no table, make one else - check_hash_table(); // perform mantenience routine - - /* As said, i want to have only one get_entry */ - Entry *e = const_cast<Entry*>( get_entry(p_pair.key) ); + e = const_cast<Entry*>( get_entry(p_pair.key) ); /* if we made it up to here, the pair doesn't exist, create and assign */ @@ -301,6 +299,7 @@ public: e=create_entry(p_pair.key); if (!e) return; + check_hash_table(); // perform mantenience routine } e->pair.data = p_pair.data; @@ -478,12 +477,11 @@ public: } inline TData& operator[](const TKey& p_key ) { //assignment + Entry *e=NULL; if (!hash_table) make_hash_table(); // if no table, make one else - check_hash_table(); // perform mantenience routine - - Entry *e = const_cast<Entry*>( get_entry(p_key) ); + e = const_cast<Entry*>( get_entry(p_key) ); /* if we made it up to here, the pair doesn't exist, create */ if (!e) { @@ -491,6 +489,7 @@ public: e=create_entry(p_key); if (!e) return *(TData*)NULL; /* panic! */ + check_hash_table(); // perform mantenience routine } return e->pair.data; |
