projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tmp
[apps/madmutt.git]
/
lib-mx
/
hcache.c
diff --git
a/lib-mx/hcache.c
b/lib-mx/hcache.c
index
63ea970
..
de0e3e0
100644
(file)
--- a/
lib-mx/hcache.c
+++ b/
lib-mx/hcache.c
@@
-16,10
+16,6
@@
#if defined(HAVE_TOKYOCABINET)
#include <tcutil.h>
#include <tchdb.h>
#if defined(HAVE_TOKYOCABINET)
#include <tcutil.h>
#include <tchdb.h>
-#elif defined(HAVE_QDBM)
-#include <depot.h>
-#include <cabin.h>
-#include <villa.h>
#elif defined(HAVE_GDBM)
#include <gdbm.h>
#else
#elif defined(HAVE_GDBM)
#include <gdbm.h>
#else
@@
-33,8
+29,6
@@
struct hcache_t {
#if defined(HAVE_TOKYOCABINET)
TCHDB *db;
struct hcache_t {
#if defined(HAVE_TOKYOCABINET)
TCHDB *db;
-#elif defined(HAVE_QDBM)
- VILLA *db;
#elif defined(HAVE_GDBM)
GDBM_FILE db;
#endif
#elif defined(HAVE_GDBM)
GDBM_FILE db;
#endif
@@
-193,8
+187,9
@@
static const void *restore_list(const char *d, string_list_t **l)
return d;
}
return d;
}
-static void dump_parameter(buffer_t *buf, parameter_t *p)
+static void dump_parameter(buffer_t *buf, parameter
s
_t *p)
{
{
+#if 0
int pos = buf->len, counter = 0;
dump_int(buf, counter);
int pos = buf->len, counter = 0;
dump_int(buf, counter);
@@
-205,22
+200,24
@@
static void dump_parameter(buffer_t *buf, parameter_t *p)
}
memcpy(buf->data + pos, &counter, sizeof(counter));
}
memcpy(buf->data + pos, &counter, sizeof(counter));
+#endif
}
}
-static const void *restore_parameter(const char *d, parameter
_t **
p)
+static const void *restore_parameter(const char *d, parameter
s_t *
p)
{
int counter;
d = restore_int(d, &counter);
for (; counter > 0; counter--) {
{
int counter;
d = restore_int(d, &counter);
for (; counter > 0; counter--) {
- *p = parameter_new();
- d = restore_cstr(d, &(*p)->attribute);
- d = restore_cstr(d, &(*p)->value);
- p = &(*p)->next;
+ char *k, *v;
+ d = restore_cstr(d, &k);
+ d = restore_cstr(d, &v);
+ parameter_setval(p, k, v);
+ p_delete(&k);
+ p_delete(&v);
}
}
- *p = NULL;
return d;
}
return d;
}
@@
-246,7
+243,7
@@
static const void *restore_body(const char *d, BODY *c)
d = restore_cstr(d, &c->xtype);
d = restore_cstr(d, &c->subtype);
d = restore_cstr(d, &c->xtype);
d = restore_cstr(d, &c->subtype);
- d = restore_parameter(d,
&
c->parameter);
+ d = restore_parameter(d, c->parameter);
d = restore_cstr(d, &c->description);
d = restore_cstr(d, &c->form_name);
d = restore_cstr(d, &c->description);
d = restore_cstr(d, &c->form_name);
@@
-347,6
+344,7
@@
HEADER *mutt_hcache_restore(const void *_d, HEADER **oh)
d = restore_envelope(d, h->env);
h->content = body_new();
d = restore_envelope(d, h->env);
h->content = body_new();
+ h->content->parameter = parameter_new();
d = restore_body(d, h->content);
d = restore_cstr(d, &h->maildir_flags);
d = restore_body(d, h->content);
d = restore_cstr(d, &h->maildir_flags);
@@
-385,8
+383,6
@@
hcache_t *mutt_hcache_open(const char *folder)
tchdbdel(h->db);
h->db = NULL;
}
tchdbdel(h->db);
h->db = NULL;
}
-#elif defined(HAVE_QDBM)
- h->db = vlopen(path, VL_OWRITER | VL_OCREAT, VL_CMPLEX);
#elif defined(HAVE_GDBM)
h->db = gdbm_open((char *) path, 16384, GDBM_WRCREAT, 00600, NULL);
#endif
#elif defined(HAVE_GDBM)
h->db = gdbm_open((char *) path, 16384, GDBM_WRCREAT, 00600, NULL);
#endif
@@
-407,8
+403,6
@@
void mutt_hcache_close(hcache_t **db)
#if defined(HAVE_TOKYOCABINET)
tchdbdel((*db)->db);
(*db)->db = NULL;
#if defined(HAVE_TOKYOCABINET)
tchdbdel((*db)->db);
(*db)->db = NULL;
-#elif defined(HAVE_QDBM)
- vlclose((*db)->db);
#elif defined(HAVE_GDBM)
gdbm_close((*db)->db);
#endif
#elif defined(HAVE_GDBM)
gdbm_close((*db)->db);
#endif
@@
-433,8
+427,6
@@
void *mutt_hcache_fetch(hcache_t *db, const char *filename,
#if defined(HAVE_TOKYOCABINET)
int unused;
data = tchdbget(db->db, path, ksize, &unused);
#if defined(HAVE_TOKYOCABINET)
int unused;
data = tchdbget(db->db, path, ksize, &unused);
-#elif defined(HAVE_QDBM)
- data = vlget(db->db, path, ksize, NULL);
#elif defined(HAVE_GDBM)
datum k = { .dptr = path, .dsize = ksize };
#elif defined(HAVE_GDBM)
datum k = { .dptr = path, .dsize = ksize };
@@
-470,8
+462,6
@@
int mutt_hcache_store(hcache_t *db, const char *filename, HEADER *header,
int ksize = keylen(path);
#if defined(HAVE_TOKYOCABINET)
ret = !!tchdbput(db->db, path, ksize, data->data, data->len) - 1;
int ksize = keylen(path);
#if defined(HAVE_TOKYOCABINET)
ret = !!tchdbput(db->db, path, ksize, data->data, data->len) - 1;
-#elif defined(HAVE_QDBM)
- ret = !!vlput(db->db, path, ksize, data->data, data->len, VL_DOVER) - 1;
#elif defined(HAVE_GDBM)
datum k = { .dptr = path, .dsize = ksize };
datum v = { .dptr = data->data, .dsize = data->len };
#elif defined(HAVE_GDBM)
datum k = { .dptr = path, .dsize = ksize };
datum v = { .dptr = data->data, .dsize = data->len };
@@
-490,7
+480,7
@@
void mutt_hcache_delete(hcache_t *db, const char *filename,
char path[_POSIX_PATH_MAX];
if (!db)
char path[_POSIX_PATH_MAX];
if (!db)
- return
-1
;
+ return;
snprintf(path, sizeof(path), "%s%s", db->folder, filename);
snprintf(path, sizeof(path), "%s%s", db->folder, filename);
@@
-498,8
+488,6
@@
void mutt_hcache_delete(hcache_t *db, const char *filename,
int ksize = keylen(path);
#if defined(HAVE_TOKYOCABINET)
tchdbout(db->db, path, ksize);
int ksize = keylen(path);
#if defined(HAVE_TOKYOCABINET)
tchdbout(db->db, path, ksize);
-#elif defined(HAVE_QDBM)
- vlout(db->db, path, ksize);
#elif defined(HAVE_GDBM)
datum k = { .dptr = path, .dsize = ksize };
gdbm_delete(db->db, k);
#elif defined(HAVE_GDBM)
datum k = { .dptr = path, .dsize = ksize };
gdbm_delete(db->db, k);