minor formatting changes for PR #114

This commit is contained in:
Fufu Fang 2023-07-26 07:45:41 +08:00
parent 282605b0ac
commit 6d8db94458
2 changed files with 12 additions and 10 deletions

View File

@ -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,13 +760,14 @@ 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) {
if (CONFIG.mode == NORMAL) {
next_table = LinkTable_new(tmp_link->f_url);
@ -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;
}