> Hmm... It's usually hard to understand the code from diff...
True. That doesn't exclude the possibility to do better however.
> Have you tried to look on the whole ngx_resolver_copy function?
Not until now.
> kind of simple if you know how compression pointers are used in DNS
> response. It's described in RFC 1035 (look for string "4.1.4. Message
> Not really sure what you've tried to say here... and how can one make it
> more readable then that...
First adding the same comment you just gave here, would help the reader to understand which algorithm exactly the code is trying to implement.
Second one classic programming sin is to use uncommented, not symbolic magic numbers. Instead the reader should be supported with some kind of hint about what those "0xc0" and "0x3f" constants mean. Be that a previous commented #define or a comment/explanation on the right of the code or something other.