summaryrefslogtreecommitdiffabout
path: root/cache.c
authorLars Hjemli <hjemli@gmail.com>2008-04-08 19:29:21 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-04-08 19:29:21 (UTC)
commit23296ad648c0e2a9e3cf40a3de322b10ad25cce3 (patch) (unidiff)
tree136493d8228b0ff4971feb06b0e8aee296367b00 /cache.c
parente2a44cf0923398396b7a321d5ce894ad3bf6f580 (diff)
parentc6f747649ace1a92ed5dfaae9cc1ea3affe0bf51 (diff)
downloadcgit-23296ad648c0e2a9e3cf40a3de322b10ad25cce3.zip
cgit-23296ad648c0e2a9e3cf40a3de322b10ad25cce3.tar.gz
cgit-23296ad648c0e2a9e3cf40a3de322b10ad25cce3.tar.bz2
Merge branch 'lh/cleanup'
* lh/cleanup: (21 commits) Reset ctx.repo to NULL when the config parser is finished Move cgit_parse_query() from parsing.c to html.c as http_parse_querystring() Move function for configfile parsing into configfile.[ch] Add cache.h Remove global and obsolete cgit_cmd Makefile: copy the QUIET constructs from the Makefile in git.git Move cgit_version from shared.c to cgit.c Makefile: autobuild dependency rules Initial Makefile cleanup Move non-generic functions from shared.c to cgit.c Add ui-shared.h Add separate header-files for each page/view Refactor snapshot support Add command dispatcher Remove obsolete cacheitem parameter to ui-functions Add struct cgit_page to cgit_context Introduce html.h Improve initialization of git directory Move cgit_repo into cgit_context Add all config variables into struct cgit_context ...
Diffstat (limited to 'cache.c') (more/less context) (show whitespace changes)
-rw-r--r--cache.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/cache.c b/cache.c
index 372e38d..89f7ecd 100644
--- a/cache.c
+++ b/cache.c
@@ -9,2 +9,3 @@
9#include "cgit.h" 9#include "cgit.h"
10#include "cache.h"
10 11
@@ -46,3 +47,3 @@ int cache_create_dirs()
46 47
47 path = fmt("%s", cgit_cache_root); 48 path = fmt("%s", ctx.cfg.cache_root);
48 if (mkdir(path, S_IRWXU) && errno!=EEXIST) 49 if (mkdir(path, S_IRWXU) && errno!=EEXIST)
@@ -50,7 +51,7 @@ int cache_create_dirs()
50 51
51 if (!cgit_repo) 52 if (!ctx.repo)
52 return 0; 53 return 0;
53 54
54 path = fmt("%s/%s", cgit_cache_root, 55 path = fmt("%s/%s", ctx.cfg.cache_root,
55 cache_safe_filename(cgit_repo->url)); 56 cache_safe_filename(ctx.repo->url));
56 57
@@ -59,6 +60,6 @@ int cache_create_dirs()
59 60
60 if (cgit_query_page) { 61 if (ctx.qry.page) {
61 path = fmt("%s/%s/%s", cgit_cache_root, 62 path = fmt("%s/%s/%s", ctx.cfg.cache_root,
62 cache_safe_filename(cgit_repo->url), 63 cache_safe_filename(ctx.repo->url),
63 cgit_query_page); 64 ctx.qry.page);
64 if (mkdir(path, S_IRWXU) && errno!=EEXIST) 65 if (mkdir(path, S_IRWXU) && errno!=EEXIST)
@@ -76,3 +77,3 @@ int cache_refill_overdue(const char *lockfile)
76 else 77 else
77 return (time(NULL) - st.st_mtime > cgit_cache_max_create_time); 78 return (time(NULL) - st.st_mtime > ctx.cfg.cache_max_create_time);
78} 79}
@@ -85,3 +86,3 @@ int cache_lock(struct cacheitem *item)
85 top: 86 top:
86 if (++i > cgit_max_lock_attempts) 87 if (++i > ctx.cfg.max_lock_attempts)
87 die("cache_lock: unable to lock %s: %s", 88 die("cache_lock: unable to lock %s: %s",