hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 121133381fd5a406444782bd171dd5e82989ddd0
parent 89827272cb71296bf172774be74daeef1de42f7b
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 20 Jun 2021 11:47:33 -0400

net::dns::decode_header: use header, not message

As the output of the function.

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mnet/dns/encoding.ha | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/dns/encoding.ha b/net/dns/encoding.ha @@ -37,20 +37,20 @@ export fn encode(buf: []u8, msg: *message) size = { // [[decode]] to completely decode the message (requiring the use of the heap), // or [[decode_question]] and [[decode_rrecord]] for the iterative decoders // (which can be used statically). -export fn decode_header(buf: []u8, msg: *message) size = { +export fn decode_header(buf: []u8, h: *header) size = { let z = 0z; - msg.header.id = endian::begetu16(buf[z..]); + h.id = endian::begetu16(buf[z..]); z += 2; let rawop = endian::begetu16(buf[z..]); - op_decode(rawop, &msg.header.op); + op_decode(rawop, &h.op); z += 2; - msg.header.qdcount = endian::begetu16(buf[z..]); + h.qdcount = endian::begetu16(buf[z..]); z += 2; - msg.header.ancount = endian::begetu16(buf[z..]); + h.ancount = endian::begetu16(buf[z..]); z += 2; - msg.header.nscount = endian::begetu16(buf[z..]); + h.nscount = endian::begetu16(buf[z..]); z += 2; - msg.header.arcount = endian::begetu16(buf[z..]); + h.arcount = endian::begetu16(buf[z..]); z += 2; return z; };