Commit 648db0b7 authored by Michał Kępień's avatar Michał Kępień Committed by Ondřej Surý

Use dns_fixedname_initname() where possible

Replace dns_fixedname_init() calls followed by dns_fixedname_name()
calls with calls to dns_fixedname_initname() where it is possible
without affecting current behavior and/or performance.

This patch was mostly prepared using Coccinelle and the following
semantic patch:

    expression fixedname, name;
    -	dns_fixedname_init(&fixedname);
    -	name = dns_fixedname_name(&fixedname);
    +	name = dns_fixedname_initname(&fixedname);

The resulting set of changes was then manually reviewed to exclude false
positives and apply minor tweaks.

It is likely that more occurrences of this pattern can be refactored in
an identical way.  This commit only takes care of the low-hanging fruit.
parent f72ed815
......@@ -259,8 +259,7 @@ perf_dns_parsetsigkey(const char *arg, isc_mem_t *mctx)
/* Name */
tsigkey->name = dns_fixedname_name(&tsigkey->fname);
tsigkey->name = dns_fixedname_initname(&tsigkey->fname);
result = name_fromstring(tsigkey->name, dns_rootname, name, namelen,
NULL, "TSIG key");
if (result != ISC_R_SUCCESS) {
......@@ -663,12 +662,10 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record,
/* Initialize */
oname = dns_fixedname_name(&foname);
oname = dns_fixedname_initname(&foname);
/* Parse zone name */
zname = dns_fixedname_name(&fzname);
zname = dns_fixedname_initname(&fzname);
result = name_fromstring(zname, dns_rootname,
input.base, strlen(input.base),
NULL, "zone");
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