From 8d71923d4f498c8d2fcb22a72346e3e77a7c4a5b Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 1 Sep 2011 15:29:19 +0200 Subject: Add a garbage collector for note files Now that we use hashes to identify notes, a garbage collector comes in handy. We search for note files that aren't referenced anywhere. Such files might come up if a note, that isn't connected with any other item, is edited. Huge parts of this code are very hackish due to our data structure layout and the way our hash table implementation works. Signed-off-by: Lukas Fleischer --- src/calcurse.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/calcurse.h') diff --git a/src/calcurse.h b/src/calcurse.h index adf9d2d..956010d 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -145,6 +145,9 @@ #define KEYS_LABELEN 8 /* length of command description */ #define KEYS_CMDS_PER_LINE 6 /* max number of commands per line */ +/* Size of the hash table the note garbage collector uses. */ +#define NOTE_GC_HSIZE 1024 + #define ERROR_MSG(...) do { \ char msg[BUFSIZ]; \ int len; \ @@ -754,6 +757,7 @@ void edit_note (char **, char *); void view_note (char *, char *); void erase_note (char **); void note_read (char *, FILE *); +void note_gc (void); /* notify.c */ int notify_time_left (void); -- cgit v1.2.3-54-g00ecf