From 5899f6c16ea30456c9d4fd8dd2cffd4396d95b5c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 3 Jun 2014 22:30:04 +0100 Subject: turn off debugging and add some comments and todo from dsilvers --- content/llcache.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'content/llcache.c') diff --git a/content/llcache.c b/content/llcache.c index f984703dd..b241ab22b 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -29,8 +29,6 @@ * * \todo instrument and (auto)tune * - * \todo turn llcache debugging off - * */ #include @@ -52,8 +50,8 @@ #include "content/urldb.h" /** Define to enable tracing of llcache operations. */ -//#undef LLCACHE_TRACE -#define LLCACHE_TRACE 1 +#undef LLCACHE_TRACE +//#define LLCACHE_TRACE 1 #ifdef LLCACHE_TRACE #define LLCACHE_LOG(x) LOG(x) @@ -2182,7 +2180,9 @@ build_candidate_list(struct llcache_object ***lst_out, int *lst_len_out) int lst_len = 0; int remaining_lifetime; - lst = calloc(512, sizeof(struct llcache_object *)); +#define MAX_PERSIST_PER_RUN 512 + + lst = calloc(MAX_PERSIST_PER_RUN, sizeof(struct llcache_object *)); if (lst == NULL) return NSERROR_NOMEM; @@ -2202,7 +2202,7 @@ build_candidate_list(struct llcache_object ***lst_out, int *lst_len_out) (remaining_lifetime > llcache->minimum_lifetime)) { lst[lst_len] = object; lst_len++; - if (lst_len == 512) + if (lst_len == MAX_PERSIST_PER_RUN) break; } } @@ -2212,11 +2212,13 @@ build_candidate_list(struct llcache_object ***lst_out, int *lst_len_out) return NSERROR_NOT_FOUND; } - /* sort list here */ + /** \todo sort list here */ *lst_len_out = lst_len; *lst_out = lst; +#undef MAX_PERSIST_PER_RUN + return NSERROR_OK; } -- cgit v1.2.3