From c1e4810221484c8e7b5e5a9423a5811a357d39dd Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 2 Nov 2020 13:31:32 +1100 Subject: [PATCH] util/disk_cache: move cache path strdup call back into disk_cache.c This code is already OS agnostic and moving it here enables code sharing in the following patches. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/util/disk_cache.c | 4 ++++ src/util/disk_cache_os.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index bf77fe0..b568b82 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -107,6 +107,10 @@ disk_cache_create(const char *gpu_name, const char *driver_id, if (!path) goto path_fail; + cache->path = ralloc_strdup(cache, path); + if (cache->path == NULL) + goto path_fail; + if (!disk_cache_mmap_cache_index(local, cache, path)) goto path_fail; diff --git a/src/util/disk_cache_os.c b/src/util/disk_cache_os.c index 52de69e..64d6fab 100644 --- a/src/util/disk_cache_os.c +++ b/src/util/disk_cache_os.c @@ -930,10 +930,6 @@ disk_cache_mmap_cache_index(void *mem_ctx, struct disk_cache *cache, int fd = -1; bool mapped = false; - cache->path = ralloc_strdup(cache, path); - if (cache->path == NULL) - goto path_fail; - path = ralloc_asprintf(mem_ctx, "%s/index", cache->path); if (path == NULL) goto path_fail; -- 2.7.4