Mercurial > dovecot > core-2.2
diff src/director/login-connection.c @ 22645:57e7fafb10c5
director: Avoid str_printfa() in login_host_callback()
Optimizes the CPU usage.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Sat, 04 Nov 2017 02:17:55 +0200 |
parents | 2ed6735ffc7a |
children | cb108f786fb4 |
line wrap: on
line diff
--- a/src/director/login-connection.c Sat Nov 04 02:05:26 2017 +0200 +++ b/src/director/login-connection.c Sat Nov 04 02:17:55 2017 +0200 @@ -158,14 +158,19 @@ 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); }