[dovecot-cvs] dovecot/src/imap cmd-select.c,1.9,1.10 cmd-status.c,1.5,1.6 commands-util.c,1.10,1.11

cras at procontrol.fi cras at procontrol.fi
Sun Dec 22 00:03:00 EET 2002


Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv15300/imap

Modified Files:
	cmd-select.c cmd-status.c commands-util.c 
Log Message:
Replaced TempString with a String which can use any memory pool and uses
Buffer internally.



Index: cmd-select.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/cmd-select.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cmd-select.c	26 Nov 2002 20:04:08 -0000	1.9
+++ cmd-select.c	21 Dec 2002 22:02:58 -0000	1.10
@@ -1,7 +1,6 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "common.h"
-#include "temp-string.h"
 #include "commands.h"
 
 int _cmd_select_full(Client *client, int readonly)

Index: cmd-status.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/cmd-status.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cmd-status.c	16 Oct 2002 22:50:21 -0000	1.5
+++ cmd-status.c	21 Dec 2002 22:02:58 -0000	1.6
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "common.h"
-#include "temp-string.h"
+#include "str.h"
 #include "commands.h"
 
 /* Returns status items, or -1 if error */
@@ -82,7 +82,7 @@
 	MailboxStatus status;
 	MailboxStatusItems items;
 	const char *mailbox;
-	TempString *str;
+	String *str;
 
 	/* <mailbox> <status items> */
 	if (!client_read_args(client, 2, 0, &args))
@@ -107,24 +107,24 @@
 		return TRUE;
 	}
 
-	str = t_string_new(128);
-	t_string_printfa(str, "* STATUS %s (", mailbox);
+	str = t_str_new(128);
+	str_printfa(str, "* STATUS %s (", mailbox);
 	if (items & STATUS_MESSAGES)
-		t_string_printfa(str, "MESSAGES %u ", status.messages);
+		str_printfa(str, "MESSAGES %u ", status.messages);
 	if (items & STATUS_RECENT)
-		t_string_printfa(str, "RECENT %u ", status.recent);
+		str_printfa(str, "RECENT %u ", status.recent);
 	if (items & STATUS_UIDNEXT)
-		t_string_printfa(str, "UIDNEXT %u ", status.uidnext);
+		str_printfa(str, "UIDNEXT %u ", status.uidnext);
 	if (items & STATUS_UIDVALIDITY)
-		t_string_printfa(str, "UIDVALIDITY %u ", status.uidvalidity);
+		str_printfa(str, "UIDVALIDITY %u ", status.uidvalidity);
 	if (items & STATUS_UNSEEN)
-		t_string_printfa(str, "UNSEEN %u ", status.unseen);
+		str_printfa(str, "UNSEEN %u ", status.unseen);
 
-	if (str->str[str->len-1] == ' ')
-		t_string_truncate(str, str->len-1);
-	t_string_append_c(str, ')');
+	if (items != 0)
+		str_truncate(str, str_len(str)-1);
+	str_append_c(str, ')');
 
-	client_send_line(client, str->str);
+	client_send_line(client, str_c(str));
 	client_send_tagline(client, "OK Status completed.");
 
 	return TRUE;

Index: commands-util.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/commands-util.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- commands-util.c	19 Dec 2002 01:53:19 -0000	1.10
+++ commands-util.c	21 Dec 2002 22:02:58 -0000	1.11
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "common.h"
-#include "temp-string.h"
+#include "str.h"
 #include "commands-util.h"
 #include "imap-util.h"
 
@@ -176,7 +176,7 @@
 static const char *get_custom_flags_string(const char *custom_flags[],
 					   unsigned int custom_flags_count)
 {
-	TempString *str;
+	String *str;
 	unsigned int i;
 
 	/* first see if there even is custom flags */
@@ -188,14 +188,14 @@
 	if (i == custom_flags_count)
 		return "";
 
-	str = t_string_new(256);
+	str = t_str_new(256);
 	for (; i < custom_flags_count; i++) {
 		if (custom_flags[i] != NULL) {
-			t_string_append_c(str, ' ');
-			t_string_append(str, custom_flags[i]);
+			str_append_c(str, ' ');
+			str_append(str, custom_flags[i]);
 		}
 	}
-	return str->str;
+	return str_c(str);
 }
 
 #define SYSTEM_FLAGS "\\Answered \\Flagged \\Deleted \\Seen \\Draft"




More information about the dovecot-cvs mailing list