dovecot-2.2: auth: Code cleanup: Minor auth_stream API simplific...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jan 30 19:11:42 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/f11ae64365b5
changeset: 15683:f11ae64365b5
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jan 30 19:11:30 2013 +0200
description:
auth: Code cleanup: Minor auth_stream API simplifications.

diffstat:

 src/auth/auth-stream.c |  19 ++++++-------------
 src/auth/auth-stream.h |   4 +---
 2 files changed, 7 insertions(+), 16 deletions(-)

diffs (56 lines):

diff -r 526aa986d534 -r f11ae64365b5 src/auth/auth-stream.c
--- a/src/auth/auth-stream.c	Wed Jan 30 19:08:00 2013 +0200
+++ b/src/auth/auth-stream.c	Wed Jan 30 19:11:30 2013 +0200
@@ -23,18 +23,16 @@
 void auth_stream_reply_add(struct auth_stream_reply *reply,
 			   const char *key, const char *value)
 {
+	i_assert(*key != '\0');
+	i_assert(strchr(key, '\t') == NULL &&
+		 strchr(key, '\n') == NULL);
+
 	if (str_len(reply->str) > 0)
 		str_append_c(reply->str, '\t');
-	if (key != NULL) {
-		i_assert(*key != '\0');
-		i_assert(strchr(key, '\t') == NULL &&
-			 strchr(key, '\n') == NULL);
 
-		str_append(reply->str, key);
-		if (value != NULL)
-			str_append_c(reply->str, '=');
-	}
+	str_append(reply->str, key);
 	if (value != NULL) {
+		str_append_c(reply->str, '=');
 		/* escape dangerous characters in the value */
 		str_append_tabescaped(reply->str, value);
 	}
@@ -143,8 +141,3 @@
 {
 	return reply == NULL || str_len(reply->str) == 0;
 }
-
-string_t *auth_stream_reply_get_str(struct auth_stream_reply *reply)
-{
-	return reply->str;
-}
diff -r 526aa986d534 -r f11ae64365b5 src/auth/auth-stream.h
--- a/src/auth/auth-stream.h	Wed Jan 30 19:08:00 2013 +0200
+++ b/src/auth/auth-stream.h	Wed Jan 30 19:11:30 2013 +0200
@@ -5,7 +5,7 @@
 
 struct auth_stream_reply *auth_stream_reply_init(pool_t pool);
 void auth_stream_reply_add(struct auth_stream_reply *reply,
-			   const char *key, const char *value) ATTR_NULL(2, 3);
+			   const char *key, const char *value) ATTR_NULL(3);
 void auth_stream_reply_reset(struct auth_stream_reply *reply);
 void auth_stream_reply_remove(struct auth_stream_reply *reply, const char *key);
 
@@ -19,6 +19,4 @@
 			      string_t *dest);
 bool auth_stream_is_empty(struct auth_stream_reply *reply);
 
-string_t *auth_stream_reply_get_str(struct auth_stream_reply *reply);
-
 #endif


More information about the dovecot-cvs mailing list