summaryrefslogtreecommitdiff
path: root/src/audit.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-14 11:55:08 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-14 11:55:08 +0300
commitab37bd0b0c0da340222f8420ec2ee6ccdd13ce24 (patch)
tree8afbdc279ebeca5fc735b89024aa3c7b5f92b4ed /src/audit.c
parente00f5ea74a448c1148725794d89a4149b98fdb11 (diff)
downloadapk-tools-ab37bd0b0c0da340222f8420ec2ee6ccdd13ce24.tar.gz
apk-tools-ab37bd0b0c0da340222f8420ec2ee6ccdd13ce24.tar.bz2
apk-tools-ab37bd0b0c0da340222f8420ec2ee6ccdd13ce24.tar.xz
apk-tools-ab37bd0b0c0da340222f8420ec2ee6ccdd13ce24.zip
db: speed up fdb creation
avoid recalculating hashes, and store the lengths of names, so we can optimize some operations.
Diffstat (limited to 'src/audit.c')
-rw-r--r--src/audit.c7
1 files changed, 3 insertions, 4 deletions
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;