From ab37bd0b0c0da340222f8420ec2ee6ccdd13ce24 Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Tue, 14 Jul 2009 11:55:08 +0300 Subject: db: speed up fdb creation avoid recalculating hashes, and store the lengths of names, so we can optimize some operations. --- src/audit.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/audit.c') diff --git a/src/audit.c b/src/audit.c index 3732aac..7a34f15 100644 --- a/src/audit.c +++ b/src/audit.c @@ -28,14 +28,14 @@ static int audit_directory(apk_hash_item item, void *ctx) struct apk_database *db = (struct apk_database *) ctx; struct dirent *de; struct apk_file_info fi; - apk_blob_t bdir = APK_BLOB_STR(dbd->dirname); + apk_blob_t bdir = APK_BLOB_PTR_LEN(dbd->name, dbd->namelen); char tmp[512], reason; DIR *dir; if (!(dbd->flags & APK_DBDIRF_PROTECTED)) return 0; - dir = opendir(dbd->dirname); + dir = opendir(dbd->name); if (dir == NULL) return 0; @@ -44,8 +44,7 @@ static int audit_directory(apk_hash_item item, void *ctx) strcmp(de->d_name, "..") == 0) continue; - snprintf(tmp, sizeof(tmp), "%s/%s", - dbd->dirname, de->d_name); + snprintf(tmp, sizeof(tmp), "%s/%s", dbd->name, de->d_name); if (apk_file_get_info(tmp, &fi) < 0) continue; -- cgit v1.2.3