From cb7337eb640b70b295edb7b05b016b53352d8713 Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Sat, 10 Jan 2009 16:25:03 +0100 Subject: db->pkgcache_loaded and db->grpcache_loaded Clearly the old code was more elegant (NULL cache indicated "not loaded"), but it had some drawbacks, so from now on we indicate the state of caches explicitly. Old drawbacks: When we had an empty database (unstable), libalpm called db_populate after every pkgcache access, because NULL pkgcache indicated "not loaded" state. This is not a common case, but the same situation can happen with grpcache, which is more problematic: If the user had a custom repo with no groups, grpcache was always NULL. (grpcache is also loaded per database.) Thus every get_grpcache call induced a load_grpcache operation, so the benefits of grpcache was completely lost. Signed-off-by: Nagy Gabor Signed-off-by: Dan McGee --- lib/libalpm/db.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/libalpm/db.h') diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h index 25b90b5f..edc4c93e 100644 --- a/lib/libalpm/db.h +++ b/lib/libalpm/db.h @@ -42,7 +42,9 @@ struct __pmdb_t { char *path; char *treename; void *handle; + unsigned short pkgcache_loaded; alpm_list_t *pkgcache; + unsigned short grpcache_loaded; alpm_list_t *grpcache; alpm_list_t *servers; }; -- cgit v1.2.3-24-g4f1b