diff options
author | Timo Teräs <timo.teras@iki.fi> | 2013-06-18 08:03:40 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2013-06-18 08:03:40 +0300 |
commit | 54509e7a1a33923569848ce69c6e7f94fc6a021b (patch) | |
tree | a64133f0311c56fe1091fae3a5e293688c3caf01 /src/hash.c | |
parent | 72139b82d3e6631c839745f3c34a5aca8c5c61e4 (diff) | |
download | apk-tools-54509e7a1a33923569848ce69c6e7f94fc6a021b.tar.gz apk-tools-54509e7a1a33923569848ce69c6e7f94fc6a021b.tar.bz2 apk-tools-54509e7a1a33923569848ce69c6e7f94fc6a021b.tar.xz apk-tools-54509e7a1a33923569848ce69c6e7f94fc6a021b.zip |
all: various conversions to foreach_array_item, and simplifications of code
Diffstat (limited to 'src/hash.c')
-rw-r--r-- | src/hash.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -29,12 +29,13 @@ void apk_hash_free(struct apk_hash *h) int apk_hash_foreach(struct apk_hash *h, apk_hash_enumerator_f e, void *ctx) { + struct hlist_head *bucket; apk_hash_node *pos, *n; ptrdiff_t offset = h->ops->node_offset; - int i, r; + int r; - for (i = 0; i < h->buckets->num; i++) { - hlist_for_each_safe(pos, n, &h->buckets->item[i]) { + foreach_array_item(bucket, h->buckets) { + hlist_for_each_safe(pos, n, bucket) { r = e(((void *) pos) - offset, ctx); if (r != 0 && ctx != NULL) return r; |