Skip to content

Commit

Permalink
fix unused but set variables
Browse files Browse the repository at this point in the history
cache.c: In function ‘cache_add_attr’:
cache.c:167:9: warning: variable ‘now’ set but not used [-Wunused-but-set-variable]
cache.c: In function ‘cache_add_dir’:
cache.c:188:9: warning: variable ‘now’ set but not used [-Wunused-but-set-variable]
cache.c: In function ‘cache_add_link’:
cache.c:212:9: warning: variable ‘now’ set but not used [-Wunused-but-set-variable]
  • Loading branch information
Miklos Szeredi authored and bfleischer committed Mar 9, 2012
1 parent 0120e6b commit c1284b4
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions cache.c
Expand Up @@ -164,15 +164,13 @@ static struct node *cache_get(const char *path)
void cache_add_attr(const char *path, const struct stat *stbuf, uint64_t wrctr)
{
struct node *node;
time_t now;

if (!cache.on)
return;

pthread_mutex_lock(&cache.lock);
if (wrctr == cache.write_ctr) {
node = cache_get(path);
now = time(NULL);
node->stat = *stbuf;
node->stat_valid = time(NULL) + cache.stat_timeout;
if (node->stat_valid > node->valid)
Expand All @@ -185,11 +183,9 @@ void cache_add_attr(const char *path, const struct stat *stbuf, uint64_t wrctr)
static 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->dir_valid = time(NULL) + cache.dir_timeout;
Expand All @@ -209,11 +205,9 @@ static size_t my_strnlen(const char *s, size_t maxsize)
static 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->link_valid = time(NULL) + cache.link_timeout;
Expand Down

0 comments on commit c1284b4

Please sign in to comment.