From 6d8db944581006896bd5c41957a0689bf5fbc7b0 Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Wed, 26 Jul 2023 07:45:41 +0800 Subject: [PATCH] minor formatting changes for PR #114 --- src/fuse_local.c | 2 +- src/link.c | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/fuse_local.c b/src/fuse_local.c index c2ecfd4..b576d1d 100644 --- a/src/fuse_local.c +++ b/src/fuse_local.c @@ -44,7 +44,7 @@ static int fs_getattr(const char *path, struct stat *stbuf) if (!link) { return -ENOENT; } - struct timespec spec = {0}; + struct timespec spec = { 0 }; spec.tv_sec = link->time; #if defined(__APPLE__) && defined(__MACH__) stbuf->st_mtimespec = spec; diff --git a/src/link.c b/src/link.c index cb0fc92..ba8d945 100644 --- a/src/link.c +++ b/src/link.c @@ -742,17 +742,17 @@ LinkTable *LinkTable_disk_open(const char *dirn) LinkTable *path_to_Link_LinkTable_new(const char *path) { - struct Link *link = NULL, *tmp_link = NULL; - struct Link linkcpy = {0}; + Link *link = NULL; + Link *tmp_link = NULL; + Link link_cpy = { 0 }; LinkTable *next_table = NULL; if (!strcmp(path, "/")) { next_table = ROOT_LINK_TBL; - linkcpy = *next_table->links[0]; - tmp_link = &linkcpy; + link_cpy = *next_table->links[0]; + tmp_link = &link_cpy; } else { link = path_to_Link(path); tmp_link = link; - LinkTable *next_table = link->next_table; } if (next_table) @@ -760,11 +760,12 @@ LinkTable *path_to_Link_LinkTable_new(const char *path) time_t time_now = time(NULL); if (time_now - next_table->index_time > CONFIG.refresh_timeout) { - // refresh directory contents + /* refresh directory contents */ LinkTable_free(next_table); next_table = NULL; - if (link) + if (link) { link->next_table = NULL; + } } } if (!next_table) { @@ -782,10 +783,11 @@ LinkTable *path_to_Link_LinkTable_new(const char *path) lprintf(fatal, "Invalid CONFIG.mode\n"); } } - if (link) + if (link) { link->next_table = next_table; - else + } else { ROOT_LINK_TBL = next_table; + } return next_table; }