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