From 93b45a80a15d147437b83e8cc9f1575b0a3b3d13 Mon Sep 17 00:00:00 2001 From: g Date: Sun, 1 Feb 2004 19:02:46 +0000 Subject: [PATCH] Tree timestamp bug fix. git-svn-id: file:///srv/svn/gliv/trunk@229 dbf4865f-1ec6-0310-8412-f61adeb1ccb1 committer: g --- src/images_menus.c | 2 +- src/include/tree.h | 2 +- src/tree.c | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/images_menus.c b/src/images_menus.c index af9a9a2..ae50310 100644 --- a/src/images_menus.c +++ b/src/images_menus.c @@ -338,7 +338,7 @@ static GNode *get_tree(void) return TRUE; \ } \ \ - if (has_timestamp(timestamp) && last_tree_ok(timestamp)) \ + if (more_recent_than_tree(timestamp)) \ /* The menu is already up to date. */ \ return TRUE; \ \ diff --git a/src/include/tree.h b/src/include/tree.h index 83641fa..859c9cb 100644 --- a/src/include/tree.h +++ b/src/include/tree.h @@ -14,7 +14,7 @@ typedef struct { void end_using_tree(void); void cancel_using_tree(void); gboolean canceled_using_tree(void); -gboolean last_tree_ok(timestamp_t menu_timestamp); +gboolean more_recent_than_tree(timestamp_t ts); GNode *make_tree(void); void destroy_tree(GNode * tree); void invalidate_last_tree(void); diff --git a/src/tree.c b/src/tree.c index 9b2d3d6..fb74c68 100644 --- a/src/tree.c +++ b/src/tree.c @@ -282,7 +282,7 @@ static void compress_tree(GNode * node) static void print_tree(GNode * tree, gint level); /* Can we avoid rebuilding a tree? */ -gboolean last_tree_ok(timestamp_t menu_timestamp) +static gboolean last_tree_ok(void) { timestamp_t list_timestamp = get_list_timestamp(); @@ -290,14 +290,16 @@ gboolean last_tree_ok(timestamp_t menu_timestamp) /* No tree to reuse. */ return FALSE; - if (up_to_date(timestamp, list_timestamp) == FALSE) - /* The list has changed. */ - return FALSE; + /* Check if the list has changed. */ + return up_to_date(timestamp, list_timestamp); +} - if (menu_timestamp) - return up_to_date(menu_timestamp, timestamp); +gboolean more_recent_than_tree(timestamp_t ts) +{ + if (last_tree_ok() == FALSE) + return FALSE; - return TRUE; + return up_to_date(ts, timestamp); } GNode *make_tree(void) @@ -311,7 +313,7 @@ GNode *make_tree(void) return NULL; cancel = FALSE; - if (last_tree_ok(0)) + if (last_tree_ok()) return last_tree; invalidate_last_tree(); -- 2.11.4.GIT