From 53668483bb18d6c071434f44cfc23f856889823d Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 5 Jun 2023 20:42:05 +0200 Subject: [PATCH] simplify question to bytes --- lib/query.ml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/query.ml b/lib/query.ml index f5454e7..f2f9a21 100644 --- a/lib/query.ml +++ b/lib/query.ml @@ -14,11 +14,8 @@ let header_to_bytes header = ;; let question_to_bytes question = - let buffer1 = new_buffer question [ question.type_; question.class_ ] in - let buffer2 = Buffer.create (Bytes.length question.name + Bytes.length buffer1) in - Buffer.add_bytes buffer2 question.name; - Buffer.add_bytes buffer2 buffer1; - buffer2 + let buffer = new_buffer question [ question.type_; question.class_ ] in + Bytes.cat buffer question.name ;; let encode_dns_name domain_name =