Rocco Rutte:
[apps/madmutt.git] / hcache.c
index c6892ff..62ef8dc 100644 (file)
--- a/hcache.c
+++ b/hcache.c
@@ -177,9 +177,6 @@ static unsigned char *dump_address (ADDRESS * a, unsigned char *d, int *off)
   d = dump_int (0xdeadbeef, d, off);
 
   while (a) {
-#ifdef EXACT_ADDRESS
-    d = dump_char (a->val, d, off);
-#endif
     d = dump_char (a->personal, d, off);
     d = dump_char (a->mailbox, d, off);
     d = dump_int (a->group, d, off);
@@ -200,9 +197,6 @@ static void restore_address (ADDRESS ** a, const unsigned char *d, int *off)
 
   while (counter) {
     *a = safe_malloc (sizeof (ADDRESS));
-#ifdef EXACT_ADDRESS
-    restore_char (&(*a)->val, d, off);
-#endif
     restore_char (&(*a)->personal, d, off);
     restore_char (&(*a)->mailbox, d, off);
     restore_int ((unsigned int *) &(*a)->group, d, off);
@@ -463,12 +457,6 @@ static int generate_crc32 ()
            safe_strlen ("HAVE_LANGINFO_CODESET"));
 #endif
 
-#if EXACT_ADDRESS
-  crc =
-    crc32 (crc, (unsigned char const *) "EXACT_ADDRESS",
-           safe_strlen ("EXACT_ADDRESS"));
-#endif
-
 #ifdef USE_POP
   crc =
     crc32 (crc, (unsigned char const *) "USE_POP", safe_strlen ("USE_POP"));
@@ -617,10 +605,7 @@ void *
 mutt_hcache_open(const char *path, const char *folder)
 {
   struct header_cache *h = safe_calloc(1, sizeof (HEADER_CACHE));
-  int    flags = 0;
-#if 0 /* FIXME */
-  int pagesize = atoi(HeaderCachePageSize) ? atoi(HeaderCachePageSize) : 16384;
-#endif
+  int    flags = VL_OWRITER | VL_OCREAT;
   h->db = NULL;
   h->folder = safe_strdup(folder);
   h->crc = generate_crc32();
@@ -635,14 +620,9 @@ mutt_hcache_open(const char *path, const char *folder)
   path = mutt_hcache_per_folder(path, folder);
 
   if (option(OPTHCACHECOMPRESS))
-    flags = VL_OZCOMP;
+    flags |= VL_OZCOMP;
 
-  h->db = vlopen(path, flags | VL_OWRITER | VL_OCREAT, VL_CMPLEX);
-  if (h->db)
-    return h;
-
-  /* if rw failed try ro */
-  h->db = vlopen(path, flags | VL_OREADER, VL_CMPLEX);
+  h->db = vlopen(path, flags, VL_CMPLEX);
   if (h->db)
     return h;
   else
@@ -688,9 +668,7 @@ mutt_hcache_fetch(void *db, const char *filename,
 
   if (! crc32_matches(data, h->crc))
   {
-    if (data) { 
-      FREE(&data);
-    }
+    FREE(&data);
     return NULL;
   }
 
@@ -815,7 +793,7 @@ void *mutt_hcache_fetch (void *db, const char *filename,
   data = gdbm_fetch (h->db, key);
 
   if (!crc32_matches (data.dptr, h->crc)) {
-    free (data.dptr);
+    FREE(&data.dptr);
     return NULL;
   }
 
@@ -995,7 +973,7 @@ void *mutt_hcache_fetch (void *db, const char *filename,
   h->db->get (h->db, NULL, &key, &data, 0);
 
   if (!crc32_matches (data.data, h->crc)) {
-    free (data.data);
+    FREE(&data.data);
     return NULL;
   }