Permalink
Browse files

rename Mem_T to Stream_T

  • Loading branch information...
pjstevns committed Sep 27, 2012
1 parent 2641cae commit 5dd0966d5c42e87736afa2c2b0fe53a54ff8f449
View
166 configure

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -326,9 +326,24 @@ dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[pic_mode="$withval"],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for lt_pkg in $withval; do
IFS="$lt_save_ifs"
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[pic_mode=default])
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
View
@@ -62,7 +62,7 @@ SERVER = server.c \
dm_tls.c \
dm_http.c \
dm_request.c \
dm_memblock.c \
dm_stream.c \
dm_cache.c \
dm_cidr.c
View
@@ -108,7 +108,7 @@ am__libdbmail_la_SOURCES_DIST = dbmail-user.c dbmail-message.c \
dm_acl.c dm_misc.c dm_pidfile.c dm_digest.c dm_match.c \
dm_iconv.c dm_dsn.c dm_sset.c dm_getopt.c server.c \
clientsession.c clientbase.c dm_tls.c dm_http.c dm_request.c \
dm_memblock.c dm_cache.c dm_cidr.c authmodule.c sortmodule.c
dm_stream.c dm_cache.c dm_cidr.c authmodule.c sortmodule.c
@USE_DM_GETOPT_TRUE@am__objects_1 = libdbmail_la-dm_getopt.lo
am__objects_2 = libdbmail_la-dbmail-user.lo \
libdbmail_la-dbmail-message.lo libdbmail_la-dbmail-mailbox.lo \
@@ -124,7 +124,7 @@ am__objects_2 = libdbmail_la-dbmail-user.lo \
am__objects_3 = libdbmail_la-server.lo libdbmail_la-clientsession.lo \
libdbmail_la-clientbase.lo libdbmail_la-dm_tls.lo \
libdbmail_la-dm_http.lo libdbmail_la-dm_request.lo \
libdbmail_la-dm_memblock.lo libdbmail_la-dm_cache.lo \
libdbmail_la-dm_stream.lo libdbmail_la-dm_cache.lo \
libdbmail_la-dm_cidr.lo
@SHARED_TRUE@am__objects_4 = libdbmail_la-authmodule.lo \
@SHARED_TRUE@ libdbmail_la-sortmodule.lo
@@ -405,7 +405,7 @@ SERVER = server.c \
dm_tls.c \
dm_http.c \
dm_request.c \
dm_memblock.c \
dm_stream.c \
dm_cache.c \
dm_cidr.c
@@ -635,12 +635,12 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-dm_list.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-dm_mailboxstate.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-dm_match.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-dm_memblock.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-dm_misc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-dm_pidfile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-dm_request.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-dm_sievescript.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-dm_sset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-dm_stream.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-dm_tls.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-server.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbmail_la-sortmodule.Plo@am__quote@
@@ -858,12 +858,12 @@ libdbmail_la-dm_request.lo: dm_request.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbmail_la_CFLAGS) $(CFLAGS) -c -o libdbmail_la-dm_request.lo `test -f 'dm_request.c' || echo '$(srcdir)/'`dm_request.c
libdbmail_la-dm_memblock.lo: dm_memblock.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbmail_la_CFLAGS) $(CFLAGS) -MT libdbmail_la-dm_memblock.lo -MD -MP -MF $(DEPDIR)/libdbmail_la-dm_memblock.Tpo -c -o libdbmail_la-dm_memblock.lo `test -f 'dm_memblock.c' || echo '$(srcdir)/'`dm_memblock.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libdbmail_la-dm_memblock.Tpo $(DEPDIR)/libdbmail_la-dm_memblock.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dm_memblock.c' object='libdbmail_la-dm_memblock.lo' libtool=yes @AMDEPBACKSLASH@
libdbmail_la-dm_stream.lo: dm_stream.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbmail_la_CFLAGS) $(CFLAGS) -MT libdbmail_la-dm_stream.lo -MD -MP -MF $(DEPDIR)/libdbmail_la-dm_stream.Tpo -c -o libdbmail_la-dm_stream.lo `test -f 'dm_stream.c' || echo '$(srcdir)/'`dm_stream.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libdbmail_la-dm_stream.Tpo $(DEPDIR)/libdbmail_la-dm_stream.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dm_stream.c' object='libdbmail_la-dm_stream.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbmail_la_CFLAGS) $(CFLAGS) -c -o libdbmail_la-dm_memblock.lo `test -f 'dm_memblock.c' || echo '$(srcdir)/'`dm_memblock.c
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbmail_la_CFLAGS) $(CFLAGS) -c -o libdbmail_la-dm_stream.lo `test -f 'dm_stream.c' || echo '$(srcdir)/'`dm_stream.c
libdbmail_la-dm_cache.lo: dm_cache.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbmail_la_CFLAGS) $(CFLAGS) -MT libdbmail_la-dm_cache.lo -MD -MP -MF $(DEPDIR)/libdbmail_la-dm_cache.Tpo -c -o libdbmail_la-dm_cache.lo `test -f 'dm_cache.c' || echo '$(srcdir)/'`dm_cache.c
View
@@ -57,7 +57,7 @@ extern Cache_T cache;
* sends cnt bytes from a MEM structure to a FILE stream
* uses a simple buffering system
*/
static void send_data(ImapSession *self, Mem_T M, int cnt)
static void send_data(ImapSession *self, Stream_T M, int cnt)
{
char buf[SEND_BUF_SIZE];
size_t l;
@@ -67,14 +67,14 @@ static void send_data(ImapSession *self, Mem_T M, int cnt)
TRACE(TRACE_DEBUG,"[%p] M [%p] cnt [%d]", self, M, cnt);
while (cnt >= SEND_BUF_SIZE) {
memset(buf,0,sizeof(buf));
l = Mem_read(M, buf, SEND_BUF_SIZE-1);
l = Stream_read(M, buf, SEND_BUF_SIZE-1);
if (l>0) dbmail_imap_session_buff_printf(self, "%s", buf);
cnt -= l;
}
if (cnt > 0) {
memset(buf,0,sizeof(buf));
l = Mem_read(M, buf, cnt);
l = Stream_read(M, buf, cnt);
if (l>0) dbmail_imap_session_buff_printf(self, "%s", buf);
cnt -= l;
}
@@ -159,12 +159,12 @@ static uint64_t dbmail_imap_session_message_load(ImapSession *self)
self->message = msg;
} else {
GString *s;
Mem_T M = Mem_new();
Stream_T M = Stream_new();
gchar *cached = g_new0(char, size);
DbmailMessage *msg = dbmail_message_new();
Cache_get_mem(cache, *id, M);
Mem_read(M, cached, size);
Stream_read(M, cached, size);
s = g_string_new_len(cached, size);
g_free(cached);
msg = dbmail_message_init_with_string(msg, s);
@@ -909,7 +909,7 @@ static int _fetch_get_items(ImapSession *self, uint64_t *uid)
gchar *s = NULL;
uint64_t *id = uid;
gboolean reportflags = FALSE;
Mem_T M;
Stream_T M;
MessageInfo *msginfo = g_tree_lookup(MailboxState_getMsginfo(self->mailbox->mbstate), uid);
@@ -929,7 +929,7 @@ static int _fetch_get_items(ImapSession *self, uint64_t *uid)
if (! (dbmail_imap_session_message_load(self)))
return 0;
M = Mem_new();
M = Stream_new();
Cache_get_mem(cache, self->message->id, M);
size = Cache_get_size(cache, self->message->id);
}
@@ -1003,7 +1003,7 @@ static int _fetch_get_items(ImapSession *self, uint64_t *uid)
dbmail_imap_session_buff_printf(self, "BODY[] {%lu}\r\n", size);
send_data(self, M, size);
} else {
Mem_seek(M, dbmail_imap_session_bodyfetch_get_last_octetstart(self), SEEK_SET);
Stream_seek(M, dbmail_imap_session_bodyfetch_get_last_octetstart(self), SEEK_SET);
size = (dbmail_imap_session_bodyfetch_get_last_octetcnt(self) >
(((long long)size) - dbmail_imap_session_bodyfetch_get_last_octetstart(self)))
? (((long long)size) - dbmail_imap_session_bodyfetch_get_last_octetstart(self))
@@ -1023,8 +1023,8 @@ static int _fetch_get_items(ImapSession *self, uint64_t *uid)
char buff[2], c = 0, p1 = 0, p2 = 0;
memset(buff, 0, sizeof(buff));
Mem_rewind(M);
i = Mem_read(M, buff, 1);
Stream_rewind(M);
i = Stream_read(M, buff, 1);
while (i) {
c = buff[0];
@@ -1035,21 +1035,21 @@ static int _fetch_get_items(ImapSession *self, uint64_t *uid)
p2 = p1;
p1 = c;
memset(buff, 0, sizeof(buff));
i = Mem_read(M, buff, 1);
i = Stream_read(M, buff, 1);
bodyoffset++;
}
}
if (self->fi->getRFC822Header) {
SEND_SPACE;
Mem_rewind(M);
Stream_rewind(M);
dbmail_imap_session_buff_printf(self, "RFC822.HEADER {%lu}\r\n", bodyoffset);
send_data(self, M, bodyoffset);
}
if (self->fi->getRFC822Text) {
SEND_SPACE;
Mem_seek(M, bodyoffset, SEEK_SET);
Stream_seek(M, bodyoffset, SEEK_SET);
dbmail_imap_session_buff_printf(self, "RFC822.TEXT {%lu}\r\n", size-bodyoffset);
send_data(self, M, size-bodyoffset);
self->fi->setseen = 1;
View
@@ -28,7 +28,7 @@
/*
* cached raw message data
*
* implement a global message cache as a LIST of Mem_T objects
* implement a global message cache as a LIST of Stream_T objects
* with reference bookkeeping and TTL
*
*/
@@ -47,7 +47,7 @@ struct element {
long ttl;
uint64_t ref;
uint64_t size;
Mem_T mem;
Stream_T mem;
LIST_ENTRY(element) elements;
};
@@ -125,7 +125,7 @@ static struct element * Cache_find(T C, uint64_t id)
static void Cache_remove(T C, struct element *E)
{
LIST_REMOVE(E, elements);
Mem_close(&E->mem);
Stream_close(&E->mem);
C->size -= (E->size + sizeof(*E));
free(E);
}
@@ -170,11 +170,11 @@ uint64_t Cache_update(T C, DbmailMessage *message)
E->id = message->id;
E->size = outcnt;
E->ttl = now + TTL_SECONDS;
E->mem = Mem_open();
E->mem = Stream_open();
Mem_rewind(E->mem);
Mem_write(E->mem, crlf, outcnt);
Mem_rewind(E->mem);
Stream_rewind(E->mem);
Stream_write(E->mem, crlf, outcnt);
Stream_rewind(E->mem);
C->size += outcnt + sizeof(*E);
@@ -201,7 +201,7 @@ uint64_t Cache_get_size(T C, uint64_t id)
return size;
}
void Cache_get_mem(T C, uint64_t id, Mem_T M)
void Cache_get_mem(T C, uint64_t id, Stream_T M)
{
time_t now = time(NULL);
struct element *E;
@@ -211,14 +211,14 @@ void Cache_get_mem(T C, uint64_t id, Mem_T M)
assert(E);
E->ref++;
E->ttl = now + TTL_SECONDS;
Mem_ref(E->mem, M);
Stream_ref(E->mem, M);
CACHE_UNLOCK(C->lock);
}
void Cache_unref_mem(T C, uint64_t id, Mem_T *M)
void Cache_unref_mem(T C, uint64_t id, Stream_T *M)
{
time_t now = time(NULL);
Mem_T m = *M;
Stream_T m = *M;
struct element *E;
assert(C);
assert(m);
View
@@ -21,7 +21,7 @@
#ifndef DM_CACHE_H
#define DM_CACHE_H
#include "dm_memblock.h"
#include "dm_stream.h"
#define T Cache_T
@@ -31,8 +31,8 @@ extern T Cache_new(void);
extern void Cache_clear(T C, uint64_t message_idnr);
extern uint64_t Cache_update(T C, DbmailMessage *message);
extern uint64_t Cache_get_size(T C, uint64_t message_idnr);
extern void Cache_get_mem(T C, uint64_t message_idnr, Mem_T);
extern void Cache_unref_mem(T C, uint64_t message_idnr, Mem_T *);
extern void Cache_get_mem(T C, uint64_t message_idnr, Stream_T);
extern void Cache_unref_mem(T C, uint64_t message_idnr, Stream_T *);
extern void Cache_free(T *C);
#undef T
Oops, something went wrong.

0 comments on commit 5dd0966

Please sign in to comment.