From 7be853e63785276338a4c4d9e5be084f24114bed Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Sat, 5 Jun 2010 12:06:41 +0300 Subject: all: rework how arrays work Instead of having a null pointer, use a dummy array which just says the array is empty. This helps in multiple places of the code which would otherwise need explicitly need to check first if the array exists. This has been cause of multiple seg.faults in the past as the array check is easily omitted. This also removes (or fixes) all existing checks accordingly. --- src/cache.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/cache.c') diff --git a/src/cache.c b/src/cache.c index 85d9777..4ed89fa 100644 --- a/src/cache.c +++ b/src/cache.c @@ -32,9 +32,6 @@ static int cache_download(struct apk_database *db) char item[PATH_MAX], cacheitem[PATH_MAX]; int i, r = 0; - if (db->world == NULL) - return 0; - state = apk_state_new(db); if (state == NULL) goto err; @@ -111,7 +108,7 @@ static int cache_clean(struct apk_database *db) } else { /* Package - search for it */ name = apk_db_get_name(db, bname); - if (name == NULL || name->pkgs == NULL) + if (name == NULL) break; for (i = 0; i < name->pkgs->num; i++) { struct apk_package *pkg = name->pkgs->item[i]; -- cgit v1.2.3-60-g2f50