[nginx] Resolver: reworked ngx_resolver_copy() copy loop.
Maxim Dounin
mdounin at mdounin.ru
Tue May 25 15:33:23 UTC 2021
details: https://hg.nginx.org/nginx/rev/771743838cbd
branches:
changeset: 7852:771743838cbd
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 aa5f8825f24d -r 771743838cbd 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