Archived
1
0
Fork 0

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.
This commit is contained in:
Henrik Hautakoski 2012-04-17 21:14:49 +02:00
parent 4f05a5ae4f
commit e0976e0d23
2 changed files with 5 additions and 17 deletions

View file

@ -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);
}

View file

@ -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 */