Skip to content

Commit

Permalink
lib-smtp: smtp-server - Remove redundant debug logging checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanbosch committed Mar 2, 2019
1 parent 3313775 commit 70f070f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 24 deletions.
9 changes: 3 additions & 6 deletions src/lib-smtp/smtp-server-command.c
Expand Up @@ -130,14 +130,11 @@ void smtp_server_command_debug(struct smtp_server_cmd_ctx *cmd,
const char *format, ...)
{
struct smtp_server_connection *conn = cmd->conn;
const struct smtp_server_settings *set = &conn->set;
va_list args;

if (set->debug) {
va_start(args, format);
e_debug(conn->event, "%s", t_strdup_vprintf(format, args));
va_end(args);
}
va_start(args, format);
e_debug(conn->event, "%s", t_strdup_vprintf(format, args));
va_end(args);
}

/*
Expand Down
8 changes: 3 additions & 5 deletions src/lib-smtp/smtp-server-connection.c
Expand Up @@ -40,11 +40,9 @@ void smtp_server_connection_debug(struct smtp_server_connection *conn,
{
va_list args;

if (conn->set.debug) {
va_start(args, format);
e_debug(conn->event, "%s", t_strdup_vprintf(format, args));
va_end(args);
}
va_start(args, format);
e_debug(conn->event, "%s", t_strdup_vprintf(format, args));
va_end(args);
}

void smtp_server_connection_error(struct smtp_server_connection *conn,
Expand Down
18 changes: 5 additions & 13 deletions src/lib-smtp/smtp-server-reply.c
Expand Up @@ -17,16 +17,11 @@ static inline void ATTR_FORMAT(2, 3)
smtp_server_reply_debug(struct smtp_server_reply *reply,
const char *format, ...)
{
struct smtp_server_command *command = reply->command;
struct smtp_server_connection *conn = command->context.conn;
const struct smtp_server_settings *set = &conn->set;
va_list args;

if (set->debug) {
va_start(args, format);
e_debug(reply->event, "%s", t_strdup_vprintf(format, args));
va_end(args);
}
va_start(args, format);
e_debug(reply->event, "%s", t_strdup_vprintf(format, args));
va_end(args);
}

/*
Expand Down Expand Up @@ -443,7 +438,6 @@ static int smtp_server_reply_send_real(struct smtp_server_reply *reply)
{
struct smtp_server_command *cmd = reply->command;
struct smtp_server_connection *conn = cmd->context.conn;
const struct smtp_server_settings *set = &conn->set;
struct ostream *output = conn->conn.output;
string_t *textbuf;
char *text;
Expand All @@ -466,10 +460,8 @@ static int smtp_server_reply_send_real(struct smtp_server_reply *reply)
return -1;
}

if (set->debug) {
smtp_server_reply_debug(reply, "Sent: %s",
smtp_server_reply_get_one_line(reply));
}
smtp_server_reply_debug(reply, "Sent: %s",
smtp_server_reply_get_one_line(reply));
return ret;
}

Expand Down

0 comments on commit 70f070f

Please sign in to comment.