Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Drop the cache's checks for arguments never NULL
The cache root always holds a default or a copy, the key comes from a strbuf, and every string hashed is the same or a macro expansion.
Diffstat (limited to 'source')
-rw-r--r--source/cache.c14
1 file changed, 0 insertions, 14 deletions
diff --git a/source/cache.c b/source/cache.c
index 7a39f1b..7b4e0dd 100644
--- a/source/cache.c
+++ b/source/cache.c
@@ -499,9 +499,6 @@ unsigned long cache_hash_str(const char *str)
unsigned long h = FNV_OFFSET;
unsigned char *s = (unsigned char *)str;
- if (!s)
- return h;
-
while (*s) {
h *= FNV_PRIME;
h ^= *s++;
@@ -524,13 +521,6 @@ int cache_process(int size, const char *path, const char *key, int ttl, size_t m
return 0;
}
- if (!path) {
- fprintf(stderr, "[cgit] Cache path not specified, caching is disabled\n");
- fn();
- return 0;
- }
- if (!key)
- key = "";
if (!key_fits_slot(key)) {
fprintf(stderr, "[cgit] Cache key too long for a slot, caching is disabled for this request\n");
fn();
@@ -575,10 +565,6 @@ int cache_ls(const char *path)
char *nul;
int keylen;
- if (!path) {
- fprintf(stderr, "[cgit] Cache path not specified\n");
- return -1;
- }
dir = opendir(path);
if (!dir) {
err = errno;