Use liblockfile, no need for dotlock anymore.
[apps/madmutt.git] / lib-mx / hcache.c
index 76e4a83..1b781d2 100644 (file)
@@ -59,7 +59,6 @@ static int generate_crc32(void)
     crc = crc32(crc, mod_cset.charset, m_strlen(mod_cset.charset));
 #endif
     crc = crc32(crc, "USE_POP",   m_strlen("USE_POP"));
     crc = crc32(crc, mod_cset.charset, m_strlen(mod_cset.charset));
 #endif
     crc = crc32(crc, "USE_POP",   m_strlen("USE_POP"));
-    crc = crc32(crc, "MIXMASTER", m_strlen("MIXMASTER"));
     crc = crc32(crc, "USE_IMAP",  m_strlen("USE_IMAP"));
 #ifdef USE_NNTP
     crc = crc32(crc, "USE_NNTP",  m_strlen("USE_NNTP"));
     crc = crc32(crc, "USE_IMAP",  m_strlen("USE_IMAP"));
 #ifdef USE_NNTP
     crc = crc32(crc, "USE_NNTP",  m_strlen("USE_NNTP"));
@@ -281,7 +280,6 @@ static void dump_envelope(buffer_t *buf, ENVELOPE * e)
     dump_cstr(buf, e->newsgroups);
     dump_cstr(buf, e->xref);
     dump_cstr(buf, e->followup_to);
     dump_cstr(buf, e->newsgroups);
     dump_cstr(buf, e->xref);
     dump_cstr(buf, e->followup_to);
-    dump_cstr(buf, e->x_comment_to);
 #endif
 
     dump_list(buf, e->references);
 #endif
 
     dump_list(buf, e->references);
@@ -319,7 +317,6 @@ static const void *restore_envelope(const char *d, ENVELOPE *e)
     d = restore_cstr(d, &e->newsgroups);
     d = restore_cstr(d, &e->xref);
     d = restore_cstr(d, &e->followup_to);
     d = restore_cstr(d, &e->newsgroups);
     d = restore_cstr(d, &e->xref);
     d = restore_cstr(d, &e->followup_to);
-    d = restore_cstr(d, &e->x_comment_to);
 #endif
 
     d = restore_list(d, &e->references);
 #endif
 
     d = restore_list(d, &e->references);
@@ -377,32 +374,26 @@ HEADER *mutt_hcache_restore(const void *_d, HEADER **oh)
 
 /* }}} */
 
 
 /* }}} */
 
-hcache_t *mutt_hcache_open(const char *path, const char *folder)
+hcache_t *mutt_hcache_open(const char *folder)
 {
 {
-    hcache_t *h = p_new(hcache_t, 1);
+    const char *path;
+    hcache_t *h;
 
 
-    h->folder = m_strdup(folder);
-    h->crc = generate_crc32();
-
-    if (m_strisempty(path)) {
-        p_delete(&h->folder);
-        p_delete(&h);
+    if (m_strisempty(mod_core.cachedir)) {
         return NULL;
     }
 
         return NULL;
     }
 
-    path = mutt_hcache_per_folder(path, folder);
+    h = p_new(hcache_t, 1);
+    h->folder = m_strdup(folder);
+    h->crc    = generate_crc32();
+
+    path = mutt_hcache_per_folder(mod_core.cachedir, folder);
 
     {
 #if defined(HAVE_QDBM)
 
     {
 #if defined(HAVE_QDBM)
-        int flags = VL_OWRITER | VL_OCREAT;
-        if (option(OPTHCACHECOMPRESS))
-            flags |= VL_OZCOMP;
-
-        h->db = vlopen(path, flags, VL_CMPLEX);
+        h->db = vlopen(path, VL_OWRITER | VL_OCREAT, VL_CMPLEX);
 #elif defined(HAVE_GDBM)
 #elif defined(HAVE_GDBM)
-        int pagesize = atoi(HeaderCachePageSize) ?: 16384;
-
-        h->db = gdbm_open((char *) path, pagesize, GDBM_WRCREAT, 00600, NULL);
+        h->db = gdbm_open((char *) path, 16384, GDBM_WRCREAT, 00600, NULL);
 #endif
     }
 
 #endif
     }