]> 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)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 7 Nov 2017 19:24:16 +0000 (21:24 +0200)
Optimizes the CPU usage.

src/director/login-connection.c

index 7a979a6bf7b71f999ab216c9dcd48ce412cb72e4..4a750332012af0045754c37e23495f85d989009e 100644 (file)
@@ -158,14 +158,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);
        }