Skip to content

Commit

Permalink
Remove consts when function takes ownership of parameter
Browse files Browse the repository at this point in the history
And mention that in the documentation
  • Loading branch information
wtoorop committed May 12, 2016
1 parent 61cc209 commit c47ba0a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
14 changes: 8 additions & 6 deletions ldns/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -779,31 +779,33 @@ ldns_status ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_r
* \param[in] rr_name the name to query for (as string)
* \param[in] rr_class the class to query for
* \param[in] flags packet flags
* \param[in] soa soa record to be added to the authority section
* \param[in] soa soa record to be added to the authority section (not copied).
* \return LDNS_STATUS_OK or a ldns_status mesg with the error
*/
ldns_status ldns_pkt_ixfr_request_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr* soa);

/**
* creates a packet with a query in it for the given name, type and class.
* \param[in] rr_name the name to query for
* \param[in] rr_name the name to query for (not copied).
* The returned packet will take ownership of rr_name, so the caller should not free it.
* \param[in] rr_type the type to query for
* \param[in] rr_class the class to query for
* \param[in] flags packet flags
* \return ldns_pkt* a pointer to the new pkt
*/
ldns_pkt *ldns_pkt_query_new(const ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags);
ldns_pkt *ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags);

/**
* creates an IXFR request packet for the given name, type and class.
* adds the SOA record to the authority section.
* \param[in] rr_name the name to query for
* \param[in] rr_name the name to query for (not copied).
* The returned packet will take ownership of rr_name, so the caller should not free it.
* \param[in] rr_class the class to query for
* \param[in] flags packet flags
* \param[in] soa soa record to be added to the authority section
* \param[in] soa soa record to be added to the authority section (not copied).
* \return ldns_pkt* a pointer to the new pkt
*/
ldns_pkt *ldns_pkt_ixfr_request_new(const ldns_rdf *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr* soa);
ldns_pkt *ldns_pkt_ixfr_request_new(ldns_rdf *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr* soa);

/**
* clones the given packet, creating a fully allocated copy
Expand Down
3 changes: 2 additions & 1 deletion ldns/update.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ extern "C" {
/**
* create an update packet from zone name, class and the rr lists
* \param[in] zone_rdf name of the zone
* The returned packet will take ownership of zone_rdf, so the caller should not free it
* \param[in] clas zone class
* \param[in] pr_rrlist list of Prerequisite Section RRs
* \param[in] up_rrlist list of Updates Section RRs
* \param[in] ad_rrlist list of Additional Data Section RRs (currently unused)
* \return the new packet
*/
ldns_pkt *ldns_update_pkt_new(const ldns_rdf *zone_rdf, ldns_rr_class clas, const ldns_rr_list *pr_rrlist, const ldns_rr_list *up_rrlist, const ldns_rr_list *ad_rrlist);
ldns_pkt *ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class clas, const ldns_rr_list *pr_rrlist, const ldns_rr_list *up_rrlist, const ldns_rr_list *ad_rrlist);

/**
* add tsig credentials to
Expand Down
6 changes: 3 additions & 3 deletions packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ ldns_pkt_ixfr_request_new_frm_str(ldns_pkt **p, const char *name,
}

static ldns_pkt *
ldns_pkt_query_new_internal(const ldns_rdf *rr_name, ldns_rr_type rr_type,
ldns_pkt_query_new_internal(ldns_rdf *rr_name, ldns_rr_type rr_type,
ldns_rr_class rr_class, uint16_t flags, ldns_rr* authsoa_rr)
{
ldns_pkt *packet;
Expand Down Expand Up @@ -1039,15 +1039,15 @@ ldns_pkt_query_new_internal(const ldns_rdf *rr_name, ldns_rr_type rr_type,
}

ldns_pkt *
ldns_pkt_query_new(const ldns_rdf *rr_name, ldns_rr_type rr_type,
ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type,
ldns_rr_class rr_class, uint16_t flags)
{
return ldns_pkt_query_new_internal(rr_name, rr_type,
rr_class, flags, NULL);
}

ldns_pkt *
ldns_pkt_ixfr_request_new(const ldns_rdf *rr_name, ldns_rr_class rr_class,
ldns_pkt_ixfr_request_new(ldns_rdf *rr_name, ldns_rr_class rr_class,
uint16_t flags, ldns_rr* soa)
{
ldns_rr* authsoa_rr = soa;
Expand Down
2 changes: 1 addition & 1 deletion update.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

ldns_pkt *
ldns_update_pkt_new(const ldns_rdf *zone_rdf, ldns_rr_class c,
ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class c,
const ldns_rr_list *pr_rrlist, const ldns_rr_list *up_rrlist, const ldns_rr_list *ad_rrlist)
{
ldns_pkt *p;
Expand Down

0 comments on commit c47ba0a

Please sign in to comment.