commit | c5ae7dbf4c189b986a7937fd212ea29d0b9bd1a4 | [log] [tgz] |
---|---|---|
author | Dima Zavin <dima@android.com> | Wed Apr 27 17:06:53 2011 -0700 |
committer | Android (Google) Code Review <android-gerrit@google.com> | Wed Apr 27 17:06:53 2011 -0700 |
tree | d74856689116772cb38ad88c3b27f75437f4b02e | |
parent | 4682abaaa6f714d7bcfcf861af77b1b3c3c64281 [diff] | |
parent | 4fab9ac04e444f8ad057e67006320ca25381948e [diff] |
Merge "libcutils: hashmap: save next pointer in forEach before calling callback"
diff --git a/libcutils/hashmap.c b/libcutils/hashmap.c index e29bc24..65539ea 100644 --- a/libcutils/hashmap.c +++ b/libcutils/hashmap.c
@@ -310,10 +310,11 @@ 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; } } }