Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5ae7dbf authored by Dima Zavin's avatar Dima Zavin Committed by Android (Google) Code Review
Browse files

Merge "libcutils: hashmap: save next pointer in forEach before calling callback"

parents 4682abaa 4fab9ac0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -310,10 +310,11 @@ void hashmapForEach(Hashmap* map,
    for (i = 0; i < map->bucketCount; i++) {
        Entry* entry = map->buckets[i];
        while (entry != NULL) {
            Entry *next = entry->next;
            if (!callback(entry->key, entry->value, context)) {
                return;
            }
            entry = entry->next;
            entry = next;
        }
    }
}