2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Use designated initializers instead of memset()/MEM_ZERO for structs

In several places, the structures were cleaned with memset(...)) and
thus the semantic patch converted the isc_mem_get(...) to
isc_mem_getx(..., ISC_MEM_ZERO).  Use the designated initializer to
initialized the structures instead of zeroing the memory with
ISC_MEM_ZERO flag as this better matches the intended purpose.
This commit is contained in:
Ondřej Surý
2022-08-26 11:58:51 +02:00
parent c1d26b53eb
commit c0598d404c
20 changed files with 179 additions and 158 deletions

View File

@@ -933,13 +933,12 @@ make_log_buf(dns_rrl_t *rrl, dns_rrl_entry_t *e, const char *str1,
if (qbuf != NULL) {
ISC_LIST_UNLINK(rrl->qname_free, qbuf, link);
} else if (rrl->num_qnames < DNS_RRL_QNAMES) {
qbuf = isc_mem_getx(rrl->mctx, sizeof(*qbuf),
ISC_MEM_ZERO);
{
ISC_LINK_INIT(qbuf, link);
qbuf->index = rrl->num_qnames;
rrl->qnames[rrl->num_qnames++] = qbuf;
}
qbuf = isc_mem_get(rrl->mctx, sizeof(*qbuf));
*qbuf = (dns_rrl_qname_buf_t){
.index = rrl->num_qnames,
};
ISC_LINK_INIT(qbuf, link);
rrl->qnames[rrl->num_qnames++] = qbuf;
}
if (qbuf != NULL) {
e->log_qname = qbuf->index;