aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-06-18 08:03:40 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-06-18 08:03:40 +0300
commit54509e7a1a33923569848ce69c6e7f94fc6a021b (patch)
treea64133f0311c56fe1091fae3a5e293688c3caf01 /src/hash.c
parent72139b82d3e6631c839745f3c34a5aca8c5c61e4 (diff)
downloadapk-tools-54509e7a1a33923569848ce69c6e7f94fc6a021b.tar.bz2
apk-tools-54509e7a1a33923569848ce69c6e7f94fc6a021b.tar.xz
all: various conversions to foreach_array_item, and simplifications of code
Diffstat (limited to 'src/hash.c')
-rw-r--r--src/hash.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/hash.c b/src/hash.c
index d6d432b..e59dac4 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -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;