Don't loop through buckets when map is empty
@@ -194,6 +194,10 @@ bool hasnext(
{
EcsMap *map = iter->data;
+ if (!map->count) {
+ return false;
+ }
+
if (!map->buckets) {
return false;
}
@@ -293,6 +297,7 @@ EcsMap* ecs_map_new(
void ecs_map_clear(
EcsMap *map)
{
+ if (map->count) {
int i;
for (i = 0; i < map->bucket_count; i ++) {
map->buckets[i] = 0;
@@ -302,6 +307,7 @@ void ecs_map_clear(
map->count = 0;
}
+}
void ecs_map_free(
EcsMap *map)
