From bf2f4fc17c2cb679fa7cba881dcc94b7b3705513 Mon Sep 17 00:00:00 2001 From: resver Date: Thu, 10 Jan 2013 17:00:27 +0000 Subject: [PATCH] Moved tree_attach() and tree_detach() upper so that they could be used by reset_cache(). git-svn-id: http://exfat.googlecode.com/svn/trunk@327 60bc1c72-a15a-11de-b98f-4500b42dc123 --- libexfat/node.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/libexfat/node.c b/libexfat/node.c index 9d00a79..b680208 100644 --- a/libexfat/node.c +++ b/libexfat/node.c @@ -457,6 +457,30 @@ int exfat_cache_directory(struct exfat* ef, struct exfat_node* dir) return 0; } +static void tree_attach(struct exfat_node* dir, struct exfat_node* node) +{ + node->parent = dir; + if (dir->child) + { + dir->child->prev = node; + node->next = dir->child; + } + dir->child = node; +} + +static void tree_detach(struct exfat_node* node) +{ + if (node->prev) + node->prev->next = node->next; + else /* this is the first node in the list */ + node->parent->child = node->next; + if (node->next) + node->next->prev = node->prev; + node->parent = NULL; + node->prev = NULL; + node->next = NULL; +} + static void reset_cache(struct exfat* ef, struct exfat_node* node) { struct exfat_node* child; @@ -563,30 +587,6 @@ static void erase_entry(struct exfat* ef, struct exfat_node* node) } } -static void tree_detach(struct exfat_node* node) -{ - if (node->prev) - node->prev->next = node->next; - else /* this is the first node in the list */ - node->parent->child = node->next; - if (node->next) - node->next->prev = node->prev; - node->parent = NULL; - node->prev = NULL; - node->next = NULL; -} - -static void tree_attach(struct exfat_node* dir, struct exfat_node* node) -{ - node->parent = dir; - if (dir->child) - { - dir->child->prev = node; - node->next = dir->child; - } - dir->child = node; -} - static int shrink_directory(struct exfat* ef, struct exfat_node* dir, off_t deleted_offset) { -- 2.11.0