summaryrefslogtreecommitdiffstats
path: root/src/cache.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-14 13:27:21 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-14 13:27:21 +0300
commit8d1eeb58e450ef4a81497c3233a929350af3e467 (patch)
treed2dcec64c9449ea431fb259410e1136479e21bc8 /src/cache.c
parentab37bd0b0c0da340222f8420ec2ee6ccdd13ce24 (diff)
downloadapk-tools-8d1eeb58e450ef4a81497c3233a929350af3e467.tar.bz2
apk-tools-8d1eeb58e450ef4a81497c3233a929350af3e467.tar.xz
blob: some helpers to replace snprintf
snprintf is dog slow. make the blob stuff have some helper functions so we can use them in code paths that are executed often.
Diffstat (limited to 'src/cache.c')
-rw-r--r--src/cache.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cache.c b/src/cache.c
index 6efbfe1..423af72 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -71,6 +71,7 @@ static int cache_clean(struct apk_database *db)
struct apk_package *pkg;
char path[256];
int delete, i;
+ apk_blob_t b;
csum_t csum;
snprintf(path, sizeof(path), "%s/%s", db->root, db->cache_dir);
@@ -88,9 +89,9 @@ static int cache_clean(struct apk_database *db)
do {
if (strlen(de->d_name) <= sizeof(csum_t)*2+2)
break;
- if (apk_hexdump_parse(APK_BLOB_BUF(csum),
- APK_BLOB_PTR_LEN(de->d_name,
- sizeof(csum_t) * 2)) != 0)
+ b = APK_BLOB_PTR_LEN(de->d_name, sizeof(csum_t) * 2);
+ apk_blob_pull_hexdump(&b, APK_BLOB_BUF(csum));
+ if (APK_BLOB_IS_NULL(b))
break;
if (de->d_name[sizeof(csum_t)*2] != '.')
break;