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 <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7725>
This commit is contained in:
Timothy Arceri 2020-11-02 13:31:32 +11:00 committed by Marge Bot
parent 48d7c4e0f3
commit c1e4810221
2 changed files with 4 additions and 4 deletions

View file

@ -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;

View file

@ -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;