GHash: use reinsert instead of remove/insert
authorCampbell Barton <ideasman42@gmail.com>
Thu, 8 Jan 2015 08:58:01 +0000 (19:58 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 8 Jan 2015 08:58:01 +0000 (19:58 +1100)
source/blender/blenkernel/intern/tracking_util.c
source/blender/imbuf/intern/moviecache.c

index 17e4a3c73c3409019c8e5467ac811a1d49d38f3b..882a6fabef10a09ba580822b701c6fb50231dbfd 100644 (file)
@@ -172,8 +172,7 @@ void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
                        MovieTrackingTrack *new_track = BKE_tracking_track_duplicate(track);
 
                        /* Update old-new track mapping */
-                       BLI_ghash_remove(map->hash, track, NULL, NULL);
-                       BLI_ghash_insert(map->hash, track, new_track);
+                       BLI_ghash_reinsert(map->hash, track, new_track, NULL, NULL);
 
                        BLI_addtail(&tracks, new_track);
                }
index 8589ce09b9e23fcf131ea3f6dd867ef1529a253d..cb789cc8491cf7d78ef86241642503a7d0785856 100644 (file)
@@ -363,8 +363,7 @@ static void do_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf, boo
                item->priority_data = cache->getprioritydatafp(userkey);
        }
 
-       BLI_ghash_remove(cache->hash, key, moviecache_keyfree, moviecache_valfree);
-       BLI_ghash_insert(cache->hash, key, item);
+       BLI_ghash_reinsert(cache->hash, key, item, moviecache_keyfree, moviecache_valfree);
 
        if (cache->last_userkey) {
                memcpy(cache->last_userkey, userkey, cache->keysize);