#include <lib-lib/mem.h>
#include <lib-hash/hash.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
+#include "charset.h"
#include "mutt.h"
#include <imap/message.h>
#include "mx.h"
#include "lib.h"
-static struct header_cache {
+struct header_cache {
#if defined(HAVE_QDBM)
VILLA *db;
char *folder;
int fd;
char lockfile[_POSIX_PATH_MAX];
#endif
-} HEADER_CACHE;
+};
typedef union {
struct timeval timeval;
return d;
}
-#if 0
-static unsigned char *dump_char_size (char *c, unsigned char *d, int *off,
- ssize_t size)
-{
- if (c == NULL) {
- size = 0;
- d = dump_int (size, d, off);
- return d;
- }
-
- d = dump_int (size, d, off);
- lazy_realloc (&d, *off + size);
- memcpy (d + *off, c, size);
- *off += size;
-
- return d;
-}
-#endif
-
static void restore_char (char **c, const unsigned char *d, int *off)
{
unsigned int size;
*l = NULL;
}
-#if 0
-static unsigned char *dump_buffer (BUFFER * b, unsigned char *d, int *off)
-{
- if (!b) {
- d = dump_int (0, d, off);
- return d;
- }
- else {
- d = dump_int (1, d, off);
- }
-
- d = dump_char_size (b->data, d, off, b->dsize + 1);
- d = dump_int (b->dptr - b->data, d, off);
- d = dump_int (b->dsize, d, off);
- d = dump_int (b->destroy, d, off);
-
- return d;
-}
-
-static void restore_buffer (BUFFER ** b, const unsigned char *d, int *off)
-{
- unsigned int used;
- unsigned int offset;
-
- restore_int (&used, d, off);
- if (!used) {
- return;
- }
-
- *b = p_new(BUFFER, 1);
-
- restore_char (&(*b)->data, d, off);
- restore_int (&offset, d, off);
- (*b)->dptr = (*b)->data + offset;
- restore_int (&(*b)->dsize, d, off);
- restore_int ((unsigned int *) &(*b)->destroy, d, off);
-}
-#endif
-
static unsigned char *dump_parameter (PARAMETER * p, unsigned char *d,
int *off)
{
void *mutt_hcache_open (const char *path, const char *folder)
{
- struct header_cache *h = p_new(HEADER_CACHE, 1);
+ struct header_cache *h = p_new(struct header_cache, 1);
int pagesize =
atoi (HeaderCachePageSize) ? atoi (HeaderCachePageSize) : 16384;
h->db = NULL;
struct stat sb;
u_int32_t createflags = DB_CREATE;
int ret;
- struct header_cache *h = calloc (1, sizeof (HEADER_CACHE));
+ struct header_cache *h = p_new(struct header_cache, 1);
int pagesize = atoi (HeaderCachePageSize);