[nginx] Resolver: reworked ngx_resolver_copy() copy loop.
Maxim Dounin
mdounin at mdounin.ru
Tue May 25 15:34:21 UTC 2021
details: https://hg.nginx.org/nginx/rev/0b884e47bb79
branches: stable-1.20
changeset: 7861:0b884e47bb79
user: Maxim Dounin <mdounin at mdounin.ru>
date: Tue May 25 15:17:43 2021 +0300
description:
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.
diffstat:
src/core/ngx_resolver.c | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diffs (40 lines):
diff -r a45b6a206cfc -r 0b884e47bb79 src/core/ngx_resolver.c
--- a/src/core/ngx_resolver.c Tue May 25 15:17:41 2021 +0300
+++ b/src/core/ngx_resolver.c Tue May 25 15:17:43 2021 +0300
@@ -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;
}
}
}
More information about the nginx-devel
mailing list