Mercurial > hg > nginx
comparison src/core/ngx_resolver.c @ 7852:771743838cbd
Resolver: reworked ngx_resolver_copy() copy loop.
To make the code easier to read, reworked the ngx_resolver_copy()
copy loop to match the one used to calculate length. No functional
changes.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 25 May 2021 15:17:43 +0300 |
parents | aa5f8825f24d |
children | 4ebe1251a8c3 |
comparison
equal
deleted
inserted
replaced
7851:aa5f8825f24d | 7852:771743838cbd |
---|---|
4006 return NGX_ERROR; | 4006 return NGX_ERROR; |
4007 } | 4007 } |
4008 | 4008 |
4009 name->data = dst; | 4009 name->data = dst; |
4010 | 4010 |
4011 n = *src++; | |
4012 | |
4013 for ( ;; ) { | 4011 for ( ;; ) { |
4012 n = *src++; | |
4013 | |
4014 if (n == 0) { | |
4015 name->len = dst - name->data; | |
4016 return NGX_OK; | |
4017 } | |
4018 | |
4014 if (n & 0xc0) { | 4019 if (n & 0xc0) { |
4015 n = ((n & 0x3f) << 8) + *src; | 4020 n = ((n & 0x3f) << 8) + *src; |
4016 src = &buf[n]; | 4021 src = &buf[n]; |
4017 | 4022 |
4018 n = *src++; | |
4019 | |
4020 } else { | 4023 } else { |
4021 if (dst != name->data) { | 4024 if (dst != name->data) { |
4022 *dst++ = '.'; | 4025 *dst++ = '.'; |
4023 } | 4026 } |
4024 | 4027 |
4025 ngx_strlow(dst, src, n); | 4028 ngx_strlow(dst, src, n); |
4026 dst += n; | 4029 dst += n; |
4027 src += n; | 4030 src += n; |
4028 | |
4029 n = *src++; | |
4030 } | |
4031 | |
4032 if (n == 0) { | |
4033 name->len = dst - name->data; | |
4034 return NGX_OK; | |
4035 } | 4031 } |
4036 } | 4032 } |
4037 } | 4033 } |
4038 | 4034 |
4039 | 4035 |