changeset 15683:f11ae64365b5

auth: Code cleanup: Minor auth_stream API simplifications.
author Timo Sirainen <tss@iki.fi>
date Wed, 30 Jan 2013 19:11:30 +0200
parents 526aa986d534
children cc4472f02f70
files src/auth/auth-stream.c src/auth/auth-stream.h
diffstat 2 files changed, 7 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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;
-}
--- 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