author | Lars Hjemli <hjemli@gmail.com> | 2008-03-27 08:22:13 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-03-27 08:22:13 (UTC) |
commit | ee4056bd2c902a12dea67874368863fe60ea5a5f (patch) (unidiff) | |
tree | d54da54ace7b8999cf8785d877a0a9cad5262a0c /cache.c | |
parent | dc3282f0baa14949439593729a45fbe143e3622c (diff) | |
download | cgit-ee4056bd2c902a12dea67874368863fe60ea5a5f.zip cgit-ee4056bd2c902a12dea67874368863fe60ea5a5f.tar.gz cgit-ee4056bd2c902a12dea67874368863fe60ea5a5f.tar.bz2 |
Add cache.h
The functions found in cache.c are only used by cgit.c, so there's no
point in rebuilding all object files when the cache interface is changed.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cache.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -1,33 +1,34 @@ | |||
1 | /* cache.c: cache management | 1 | /* cache.c: cache management |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | #include "cache.h" | ||
10 | 11 | ||
11 | const int NOLOCK = -1; | 12 | const int NOLOCK = -1; |
12 | 13 | ||
13 | char *cache_safe_filename(const char *unsafe) | 14 | char *cache_safe_filename(const char *unsafe) |
14 | { | 15 | { |
15 | static char buf[4][PATH_MAX]; | 16 | static char buf[4][PATH_MAX]; |
16 | static int bufidx; | 17 | static int bufidx; |
17 | char *s; | 18 | char *s; |
18 | char c; | 19 | char c; |
19 | 20 | ||
20 | bufidx++; | 21 | bufidx++; |
21 | bufidx &= 3; | 22 | bufidx &= 3; |
22 | s = buf[bufidx]; | 23 | s = buf[bufidx]; |
23 | 24 | ||
24 | while(unsafe && (c = *unsafe++) != 0) { | 25 | while(unsafe && (c = *unsafe++) != 0) { |
25 | if (c == '/' || c == ' ' || c == '&' || c == '|' || | 26 | if (c == '/' || c == ' ' || c == '&' || c == '|' || |
26 | c == '>' || c == '<' || c == '.') | 27 | c == '>' || c == '<' || c == '.') |
27 | c = '_'; | 28 | c = '_'; |
28 | *s++ = c; | 29 | *s++ = c; |
29 | } | 30 | } |
30 | *s = '\0'; | 31 | *s = '\0'; |
31 | return buf[bufidx]; | 32 | return buf[bufidx]; |
32 | } | 33 | } |
33 | 34 | ||