comparison src/http/modules/ngx_http_log_module.c @ 4984:7737f0d788c1

Access log: fixed redundant buffer reallocation. Previously a new buffer was allocated for every "access_log" directive with the same file path and "buffer=" parameters, while only one buffer per file is used.
author Valentin Bartenev <vbart@nginx.com>
date Sun, 23 Dec 2012 15:27:55 +0000
parents e89bd9896fea
children a0599b56e748
comparison
equal deleted inserted replaced
4983:2677c561127b 4984:7737f0d788c1
968 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 968 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
969 "invalid buffer value \"%V\"", &name); 969 "invalid buffer value \"%V\"", &name);
970 return NGX_CONF_ERROR; 970 return NGX_CONF_ERROR;
971 } 971 }
972 972
973 if (log->file->buffer && log->file->last - log->file->pos != buf) { 973 if (log->file->buffer) {
974 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 974 if (log->file->last - log->file->pos != buf) {
975 "access_log \"%V\" already defined " 975 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
976 "with different buffer size", &value[1]); 976 "access_log \"%V\" already defined "
977 return NGX_CONF_ERROR; 977 "with different buffer size", &value[1]);
978 return NGX_CONF_ERROR;
979 }
980
981 return NGX_CONF_OK;
978 } 982 }
979 983
980 log->file->buffer = ngx_palloc(cf->pool, buf); 984 log->file->buffer = ngx_palloc(cf->pool, buf);
981 if (log->file->buffer == NULL) { 985 if (log->file->buffer == NULL) {
982 return NGX_CONF_ERROR; 986 return NGX_CONF_ERROR;