浏览代码

core: decrease variable scope

Daniele Bartolini 3 年之前
父节点
当前提交
f53e4c0252
共有 2 个文件被更改,包括 4 次插入8 次删除
  1. 2 4
      src/core/containers/hash_map.inl
  2. 2 4
      src/core/containers/hash_set.inl

+ 2 - 4
src/core/containers/hash_map.inl

@@ -106,8 +106,7 @@ namespace hash_map_internal
 
 		const u32 hash = key_hash<TKey, Hash>(key);
 		u32 hash_i = hash & m._mask;
-		u32 dist = 0;
-		for(;;)
+		for (u32 dist = 0;;)
 		{
 			if (m._index[hash_i].index == FREE)
 				return END_OF_LIST;
@@ -129,8 +128,7 @@ namespace hash_map_internal
 		new_item.second = value;
 
 		u32 hash_i = hash & m._mask;
-		u32 dist = 0;
-		for(;;)
+		for (u32 dist = 0;;)
 		{
 			if (m._index[hash_i].index == FREE)
 				goto INSERT_AND_RETURN;

+ 2 - 4
src/core/containers/hash_set.inl

@@ -95,8 +95,7 @@ namespace hash_set_internal
 
 		const u32 hash = key_hash<TKey, Hash>(key);
 		u32 hash_i = hash & m._mask;
-		u32 dist = 0;
-		for(;;)
+		for (u32 dist = 0;;)
 		{
 			if (m._index[hash_i].index == FREE)
 				return END_OF_LIST;
@@ -118,8 +117,7 @@ namespace hash_set_internal
 		*(TKey*)new_item = key;
 
 		u32 hash_i = hash & m._mask;
-		u32 dist = 0;
-		for(;;)
+		for (u32 dist = 0;;)
 		{
 			if (m._index[hash_i].index == FREE)
 				goto INSERT_AND_RETURN;