[dovecot-cvs] dovecot/src/lib-index/mbox mbox-from.c,1.7,1.8 mbox-rewrite.c,1.47,1.48
cras at procontrol.fi
cras at procontrol.fi
Sun Dec 22 00:03:00 EET 2002
- Previous message: [dovecot-cvs] dovecot/src/lib-imap imap-bodystructure.c,1.21,1.22 imap-envelope.c,1.16,1.17 imap-envelope.h,1.4,1.5 imap-message-cache.c,1.27,1.28 imap-quote.c,1.2,1.3 imap-util.c,1.4,1.5
- Next message: [dovecot-cvs] dovecot/src/lib-mail rfc822-address.c,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/lib-index/mbox
In directory danu:/tmp/cvs-serv15300/lib-index/mbox
Modified Files:
mbox-from.c mbox-rewrite.c
Log Message:
Replaced TempString with a String which can use any memory pool and uses
Buffer internally.
Index: mbox-from.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-from.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mbox-from.c 25 Oct 2002 02:31:19 -0000 1.7
+++ mbox-from.c 21 Dec 2002 22:02:58 -0000 1.8
@@ -1,7 +1,7 @@
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
-#include "temp-string.h"
+#include "str.h"
#include "mbox-index.h"
#include <time.h>
@@ -94,54 +94,54 @@
const char *mbox_from_create(const char *sender, time_t time)
{
- TempString *str;
+ String *str;
struct tm *tm;
int year;
- str = t_string_new(256);
- t_string_append(str, "From ");
- t_string_append(str, sender);
- t_string_append(str, " ");
+ str = t_str_new(256);
+ str_append(str, "From ");
+ str_append(str, sender);
+ str_append(str, " ");
/* we could use simply asctime(), but i18n etc. may break it.
Example: "Thu Nov 29 22:33:52 2001" */
tm = localtime(&time);
/* week day */
- t_string_append(str, weekdays[tm->tm_wday]);
- t_string_append_c(str, ' ');
+ str_append(str, weekdays[tm->tm_wday]);
+ str_append_c(str, ' ');
/* month */
- t_string_append(str, months[tm->tm_mon]);
- t_string_append_c(str, ' ');
+ str_append(str, months[tm->tm_mon]);
+ str_append_c(str, ' ');
/* day */
- t_string_append_c(str, (tm->tm_mday / 10) + '0');
- t_string_append_c(str, (tm->tm_mday % 10) + '0');
- t_string_append_c(str, ' ');
+ str_append_c(str, (tm->tm_mday / 10) + '0');
+ str_append_c(str, (tm->tm_mday % 10) + '0');
+ str_append_c(str, ' ');
/* hour */
- t_string_append_c(str, (tm->tm_hour / 10) + '0');
- t_string_append_c(str, (tm->tm_hour % 10) + '0');
- t_string_append_c(str, ':');
+ str_append_c(str, (tm->tm_hour / 10) + '0');
+ str_append_c(str, (tm->tm_hour % 10) + '0');
+ str_append_c(str, ':');
/* minute */
- t_string_append_c(str, (tm->tm_min / 10) + '0');
- t_string_append_c(str, (tm->tm_min % 10) + '0');
- t_string_append_c(str, ':');
+ str_append_c(str, (tm->tm_min / 10) + '0');
+ str_append_c(str, (tm->tm_min % 10) + '0');
+ str_append_c(str, ':');
/* second */
- t_string_append_c(str, (tm->tm_sec / 10) + '0');
- t_string_append_c(str, (tm->tm_sec % 10) + '0');
- t_string_append_c(str, ' ');
+ str_append_c(str, (tm->tm_sec / 10) + '0');
+ str_append_c(str, (tm->tm_sec % 10) + '0');
+ str_append_c(str, ' ');
/* year */
year = tm->tm_year + 1900;
- t_string_append_c(str, (year / 1000) + '0');
- t_string_append_c(str, ((year / 100) % 10) + '0');
- t_string_append_c(str, ((year / 10) % 10) + '0');
- t_string_append_c(str, (year % 10) + '0');
+ str_append_c(str, (year / 1000) + '0');
+ str_append_c(str, ((year / 100) % 10) + '0');
+ str_append_c(str, ((year / 10) % 10) + '0');
+ str_append_c(str, (year % 10) + '0');
- t_string_append_c(str, '\n');
- return str->str;
+ str_append_c(str, '\n');
+ return str_c(str);
}
Index: mbox-rewrite.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-rewrite.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- mbox-rewrite.c 21 Dec 2002 10:56:55 -0000 1.47
+++ mbox-rewrite.c 21 Dec 2002 22:02:58 -0000 1.48
@@ -4,7 +4,7 @@
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
-#include "temp-string.h"
+#include "str.h"
#include "write-full.h"
#include "mbox-index.h"
#include "mbox-lock.h"
@@ -219,25 +219,25 @@
static void update_stripped_custom_flags(const char *value, size_t len,
int index, void *context)
{
- TempString *str = context;
+ String *str = context;
if (index < 0) {
/* not found, keep it */
- if (str->len != 0)
- t_string_append_c(str, ' ');
- t_string_append_n(str, value, len);
+ if (str_len(str) != 0)
+ str_append_c(str, ' ');
+ str_append_n(str, value, len);
}
}
static const char *strip_custom_flags(const char *value, size_t len,
MboxRewriteContext *ctx)
{
- TempString *str;
+ String *str;
- str = t_string_new(len+1);
+ str = t_str_new(len+1);
mbox_keywords_parse(value, len, ctx->custom_flags,
update_stripped_custom_flags, str);
- return str->len == 0 ? NULL : str->str;
+ return str_len(str) == 0 ? NULL : str_c(str);
}
static void header_func(MessagePart *part __attr_unused__,
- Previous message: [dovecot-cvs] dovecot/src/lib-imap imap-bodystructure.c,1.21,1.22 imap-envelope.c,1.16,1.17 imap-envelope.h,1.4,1.5 imap-message-cache.c,1.27,1.28 imap-quote.c,1.2,1.3 imap-util.c,1.4,1.5
- Next message: [dovecot-cvs] dovecot/src/lib-mail rfc822-address.c,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list