From 3a0573adfbcaa0614f4952ff95f044a1097e2172 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:23:39 -0700 Subject: 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. --- source/cache.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'source/cache.c') 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; -- cgit