Commit b64a7261 authored by Jan Včelák's avatar Jan Včelák 🚀

Merge branch 'pkt-clear-payload' into 'master'

parents 578e5b43 e401d3b1
......@@ -200,10 +200,12 @@ static int pkt_reset_sections(knot_pkt_t *pkt)
return knot_pkt_begin(pkt, KNOT_ANSWER);
}
/*! \brief Clear packet payload and free allocated data. */
static void pkt_clear_payload(knot_pkt_t *pkt)
_public_
void knot_pkt_clear_payload(knot_pkt_t *pkt)
{
assert(pkt);
if (!pkt) {
return;
}
/* Keep question. */
pkt->parsed = 0;
......@@ -328,7 +330,7 @@ int knot_pkt_init_response(knot_pkt_t *pkt, const knot_pkt_t *query)
knot_wire_clear_aa(pkt->wire);
/* Clear payload. */
pkt_clear_payload(pkt);
knot_pkt_clear_payload(pkt);
return KNOT_EOK;
}
......@@ -340,7 +342,7 @@ void knot_pkt_clear(knot_pkt_t *pkt)
}
/* Clear payload. */
pkt_clear_payload(pkt);
knot_pkt_clear_payload(pkt);
/* Reset to header size. */
pkt->size = KNOT_WIRE_HEADER_SIZE;
......
......@@ -156,6 +156,9 @@ int knot_pkt_copy(knot_pkt_t *dst, const knot_pkt_t *src);
*/
int knot_pkt_init_response(knot_pkt_t *pkt, const knot_pkt_t *query);
/*! \brief Clear packet payload and free allocated data. */
void knot_pkt_clear_payload(knot_pkt_t *pkt);
/*! \brief Reinitialize packet for another use. */
void knot_pkt_clear(knot_pkt_t *pkt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment