Hi Daniel, On Wed, May 25, 2022 at 08:45:09AM +0200, Daniel Wagner wrote: > On Tue, Apr 19, 2022 at 12:34:52PM +0200, Matthias Gerstner wrote: > > + ptr += DNS_HEADER_SIZE; > > + len -= DNS_HEADER_SIZE; > > here the 'sizeof(struct ...)' is hidden in the define > > > + > > + if (len < sizeof(struct domain_question) + 1) > > + return; > > > > - /* skip the query, which is a name and 2 16 bit words */ > > - l = dns_name_length(c); > > - c += l; > > - len -= l; > > - c += 4; > > - len -= 4; > > + /* skip the query, which is a name and a struct domain_question */ > > + size_t name_len = dns_name_length(ptr); > > + > > + ptr += name_len + sizeof(struct domain_question); > > and here we have the sizeof(struct ...). Personally I prefer the later > over the former because I don't have to lookup what the define is > doing. But then I do understand that it a good name of a define helps to > read. So just pick one version of it. I mostly wanted the define because of the frequently occuring and complex `sizeof(domain_hdr)` calculations. For the sake of unity I will add a few additional defines for the other sizeof() occurences. Cheers Matthias