Commit fa7a529ed4c1497b79f04fcd0484304e69b28873

Stefan Sperling 2020-01-06T12:21:37

disable delta cache in GOT_NO_OBJ_CACHE builds

diff --git a/lib/delta_cache.c b/lib/delta_cache.c
index b8d6ef3..8918a14 100644
--- a/lib/delta_cache.c
+++ b/lib/delta_cache.c
@@ -92,6 +92,7 @@ got_delta_cache_free(struct got_delta_cache *cache)
 	free(cache);
 }
 
+#ifndef GOT_NO_OBJ_CACHE
 static void
 remove_least_used_element(struct got_delta_cache *cache)
 {
@@ -107,12 +108,15 @@ remove_least_used_element(struct got_delta_cache *cache)
 	cache->nelem--;
 	cache->cache_evict++;
 }
-
+#endif
 
 const struct got_error *
 got_delta_cache_add(struct got_delta_cache *cache,
     off_t delta_data_offset, uint8_t *delta_data, size_t delta_len)
 {
+#ifdef GOT_NO_OBJ_CACHE
+	return got_error(GOT_ERR_NO_SPACE);
+#else
 	struct got_delta_cache_element *entry;
 
 	if (delta_len > cache->maxelemsize) {
@@ -134,6 +138,7 @@ got_delta_cache_add(struct got_delta_cache *cache,
 	TAILQ_INSERT_HEAD(&cache->entries, entry, entry);
 	cache->nelem++;
 	return NULL;
+#endif
 }
 
 void