aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2011-04-27 17:06:53 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-04-27 17:06:53 -0700
commitc5ae7dbf4c189b986a7937fd212ea29d0b9bd1a4 (patch)
treed74856689116772cb38ad88c3b27f75437f4b02e
parent4682abaaa6f714d7bcfcf861af77b1b3c3c64281 (diff)
parent4fab9ac04e444f8ad057e67006320ca25381948e (diff)
downloadsystem_core-c5ae7dbf4c189b986a7937fd212ea29d0b9bd1a4.tar.gz
system_core-c5ae7dbf4c189b986a7937fd212ea29d0b9bd1a4.tar.bz2
system_core-c5ae7dbf4c189b986a7937fd212ea29d0b9bd1a4.zip
Merge "libcutils: hashmap: save next pointer in forEach before calling callback"
-rw-r--r--libcutils/hashmap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libcutils/hashmap.c b/libcutils/hashmap.c
index e29bc246..65539ea3 100644
--- a/libcutils/hashmap.c
+++ b/libcutils/hashmap.c
@@ -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;
}
}
}