cache.c: fix some compiler warnings

This commit is contained in:
2024-12-26 23:59:17 +00:00
parent d0affffc5c
commit 8a4635e811

View File

@@ -107,6 +107,7 @@ static void cache_invalidate_dir(const char *path)
static void cache_do_rename(const char *from, const char *to, unsigned int flags)
{
(void) flags; //< TODO(colin): is this safe to ignore?
pthread_mutex_lock(&cache.lock);
cache_purge(from);
cache_purge(to);
@@ -129,11 +130,9 @@ static struct node *cache_get(const char *path)
void cache_add_attr(const char *path, const struct stat *stbuf)
{
struct node *node;
time_t now;
pthread_mutex_lock(&cache.lock);
node = cache_get(path);
now = time(NULL);
if (stbuf) {
node->stat = *stbuf;
node->not_found = 0;
@@ -150,11 +149,9 @@ void cache_add_attr(const char *path, const struct stat *stbuf)
void cache_add_dir(const char *path, char **dir)
{
struct node *node;
time_t now;
pthread_mutex_lock(&cache.lock);
node = cache_get(path);
now = time(NULL);
g_strfreev(node->dir);
node->dir = dir;
node->not_found = 0;
@@ -175,11 +172,9 @@ static size_t my_strnlen(const char *s, size_t maxsize)
void cache_add_link(const char *path, const char *link, size_t size)
{
struct node *node;
time_t now;
pthread_mutex_lock(&cache.lock);
node = cache_get(path);
now = time(NULL);
g_free(node->link);
node->link = g_strndup(link, my_strnlen(link, size-1));
node->not_found = 0;