]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Avoid str_printfa() in login_host_callback()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 4 Nov 2017 00:17:55 +0000 (02:17 +0200)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 6 Nov 2017 07:34:32 +0000 (09:34 +0200)
Optimizes the CPU usage.

src/director/login-connection.c

index 230acb7aa19805ab76ab3f16f675b90989e23c3c..5219c9ca9e741c3e582a0df15aed9a529e7b3b92 100644 (file)
@@ -159,14 +159,19 @@ login_host_callback(const struct mail_host *host, const char *hostname,
                line = request->line;
        } else {
                string_t *str = t_str_new(64);
+               char secs_buf[MAX_INT_STRLEN];
 
                secs = dir->set->director_user_expire / 2;
-               str_printfa(str, "%s\tproxy_refresh=%u\t", request->line, secs);
+               str_append(str, request->line);
+               str_append(str, "\tproxy_refresh=");
+               str_append(str, dec2str_buf(secs_buf, secs));
+               str_append(str, "\thost=");
                if (hostname == NULL || hostname[0] == '\0')
-                       str_printfa(str, "host=%s", host->ip_str);
+                       str_append(str, host->ip_str);
                else {
-                       str_printfa(str, "host=%s\thostip=%s",
-                                   hostname, host->ip_str);
+                       str_append(str, hostname);
+                       str_append(str, "\thostip=");
+                       str_append(str, host->ip_str);
                }
                line = str_c(str);
        }