diff options
author | Igor Sysoev <igor@sysoev.ru> | 2010-05-14 13:55:33 +0400 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2010-05-14 13:55:33 +0400 |
commit | 328df7a5cc91180fef3b1b58129e14bc79bef80b (patch) | |
tree | 1c5d8228b26c522371e2edc164f7d9104401f463 /src/core/ngx_string.c | |
parent | 5739072cfe7ecd27a1f4f70f68b508f54d9d3a75 (diff) |
use ngx_min() and ngx_max()
Diffstat (limited to 'src/core/ngx_string.c')
-rw-r--r-- | src/core/ngx_string.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c index f513753a1..95ac9cbff 100644 --- a/src/core/ngx_string.c +++ b/src/core/ngx_string.c @@ -229,9 +229,7 @@ ngx_vslprintf(u_char *buf, u_char *last, const char *fmt, va_list args) case 'V': v = va_arg(args, ngx_str_t *); - len = v->len; - len = (buf + len < last) ? len : (size_t) (last - buf); - + len = ngx_min(((size_t) (last - buf)), v->len); buf = ngx_cpymem(buf, v->data, len); fmt++; @@ -240,9 +238,7 @@ ngx_vslprintf(u_char *buf, u_char *last, const char *fmt, va_list args) case 'v': vv = va_arg(args, ngx_variable_value_t *); - len = vv->len; - len = (buf + len < last) ? len : (size_t) (last - buf); - + len = ngx_min(((size_t) (last - buf)), vv->len); buf = ngx_cpymem(buf, vv->data, len); fmt++; @@ -257,8 +253,7 @@ ngx_vslprintf(u_char *buf, u_char *last, const char *fmt, va_list args) } } else { - len = (buf + slen < last) ? slen : (size_t) (last - buf); - + len = ngx_min(((size_t) (last - buf)), slen); buf = ngx_cpymem(buf, p, len); } |