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.
This commit is contained in:
Maxim Dounin 2021-05-25 15:17:43 +03:00
parent f9c3f85f7b
commit c7b4ba76f6
1 changed files with 7 additions and 11 deletions

View File

@ -4008,15 +4008,18 @@ done:
name->data = dst;
n = *src++;
for ( ;; ) {
n = *src++;
if (n == 0) {
name->len = dst - name->data;
return NGX_OK;
}
if (n & 0xc0) {
n = ((n & 0x3f) << 8) + *src;
src = &buf[n];
n = *src++;
} else {
if (dst != name->data) {
*dst++ = '.';
@ -4025,13 +4028,6 @@ done:
ngx_strlow(dst, src, n);
dst += n;
src += n;
n = *src++;
}
if (n == 0) {
name->len = dst - name->data;
return NGX_OK;
}
}
}