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.
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++ = '.';
ngx_strlow(dst, src, n);
dst += n;
src += n;
-
- n = *src++;
- }
-
- if (n == 0) {
- name->len = dst - name->data;
- return NGX_OK;
}
}
}