From e0976e0d235c13c14beb6297db8c37914451a6e8 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 17 Apr 2012 21:14:49 +0200 Subject: [PATCH] proc-cache.c: remove proc_cache_flush() flush() is redundant, it makes more sense to just write the file on close(). There is no reason why you want to commit the current state of the cache to disk at any other time then when closing the application. --- proc-cache.c | 20 +++++--------------- proc-cache.h | 2 -- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/proc-cache.c b/proc-cache.c index 4fd0510..cc9de44 100644 --- a/proc-cache.c +++ b/proc-cache.c @@ -217,7 +217,7 @@ void proc_cache_purge(unsigned int timestamp) { } } -void proc_cache_flush() { +void proc_cache_close() { int i; struct header hdr; @@ -246,24 +246,14 @@ void proc_cache_flush() { write(fd, &ondisk.hash, 20); write(fd, &ondisk.time, sizeof(ondisk.time)); + + free(entry); } + hash_free(&table); + /* Flush it to the real file */ commit_lock(&lock); -} - -void proc_cache_close() { - - int i; - - proc_cache_flush(); release_lock(&lock); - - for(i=0; i < table.size; i++) { - struct proc_cache_entry *entry = hash_entry(&table, i); - if (entry) - free(entry); - } - hash_free(&table); } diff --git a/proc-cache.h b/proc-cache.h index 0f608ea..d347ac3 100644 --- a/proc-cache.h +++ b/proc-cache.h @@ -28,8 +28,6 @@ void proc_cache_update(const char *url); void proc_cache_purge(unsigned int timestamp); -void proc_cache_flush(); - void proc_cache_close(); #endif /* PROC_CACHE_H */