From 1a9cc552a536e15083e5eceaad39f0f8019392c5 Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Sat, 17 Jan 2009 09:28:02 +0200 Subject: del: proper ordering of file db entry deletion --- src/database.c | 4 +--- src/hash.c | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/database.c b/src/database.c index a84f2e6..190b264 100644 --- a/src/database.c +++ b/src/database.c @@ -1051,8 +1051,6 @@ static void apk_db_purge_pkg(struct apk_database *db, diri->dir->dirname, file->filename); - file->diri = NULL; - key = (struct apk_db_file_hash_key) { .dirname = APK_BLOB_STR(diri->dir->dirname), .filename = APK_BLOB_STR(file->filename), @@ -1061,7 +1059,7 @@ static void apk_db_purge_pkg(struct apk_database *db, APK_BLOB_BUF(&key)); unlink(name); __hlist_del(fc, &diri->owned_files.first); - + file->diri = NULL; db->installed.stats.files--; } apk_db_diri_rmdir(diri); diff --git a/src/hash.c b/src/hash.c index ee24a29..8013d06 100644 --- a/src/hash.c +++ b/src/hash.c @@ -100,9 +100,8 @@ void apk_hash_delete(struct apk_hash *h, apk_blob_t key) if (h->ops->compare_item(item, key) == 0) { hlist_del(pos, &h->buckets->item[hash]); h->ops->delete_item(item); - return; + break; } - } } else { hlist_for_each(pos, &h->buckets->item[hash]) { @@ -111,7 +110,7 @@ void apk_hash_delete(struct apk_hash *h, apk_blob_t key) if (h->ops->compare(key, itemkey) == 0) { hlist_del(pos, &h->buckets->item[hash]); h->ops->delete_item(item); - return; + break; } } } -- cgit v1.2.3-70-g09d2