changeset 8740:743cc6ff3d89 HEAD

Renamed imap_args_to_str() to imap_write_args() and added a new imap_args_to_str().
author Timo Sirainen <tss@iki.fi>
date Tue, 10 Feb 2009 12:01:41 -0500
parents 88ae612dc221
children d74fdb84ab8b
files src/imap/client.c src/lib-imap/imap-util.c src/lib-imap/imap-util.h
diffstat 3 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/client.c	Mon Feb 09 22:44:42 2009 -0500
+++ b/src/imap/client.c	Tue Feb 10 12:01:41 2009 -0500
@@ -314,7 +314,7 @@
 			 cmd->client->input_lock == cmd);
 
 		str = t_str_new(256);
-		imap_args_to_str(str, *args_r);
+		imap_write_args(str, *args_r);
 		cmd->args = p_strdup(cmd->pool, str_c(str));
 
 		cmd->client->input_lock = NULL;
--- a/src/lib-imap/imap-util.c	Mon Feb 09 22:44:42 2009 -0500
+++ b/src/lib-imap/imap-util.c	Tue Feb 10 12:01:41 2009 -0500
@@ -55,7 +55,7 @@
 	}
 }
 
-void imap_args_to_str(string_t *dest, const struct imap_arg *args)
+void imap_write_args(string_t *dest, const struct imap_arg *args)
 {
 	const ARRAY_TYPE(imap_arg_list) *list;
 	bool first = TRUE;
@@ -88,7 +88,7 @@
 		case IMAP_ARG_LIST:
 			str_append_c(dest, '(');
 			list = IMAP_ARG_LIST(args);
-			imap_args_to_str(dest, array_idx(list, 0));
+			imap_write_args(dest, array_idx(list, 0));
 			str_append_c(dest, ')');
 			break;
 		case IMAP_ARG_LITERAL_SIZE:
@@ -102,3 +102,12 @@
 		}
 	}
 }
+
+const char *imap_args_to_str(const struct imap_arg *args)
+{
+	string_t *str;
+
+	str = t_str_new(128);
+	imap_write_args(str, args);
+	return str_c(str);
+}
--- a/src/lib-imap/imap-util.h	Mon Feb 09 22:44:42 2009 -0500
+++ b/src/lib-imap/imap-util.h	Tue Feb 10 12:01:41 2009 -0500
@@ -13,6 +13,8 @@
 /* Write sequence range as IMAP sequence-set */
 void imap_write_seq_range(string_t *dest, const ARRAY_TYPE(seq_range) *array);
 /* Write IMAP args to given string. The string is mainly useful for humans. */
-void imap_args_to_str(string_t *dest, const struct imap_arg *args);
+void imap_write_args(string_t *dest, const struct imap_arg *args);
+/* Like imap_write_args(), but return the string allocated from data stack. */
+const char *imap_args_to_str(const struct imap_arg *args);
 
 #endif