mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Merge branch 'ondrej/coccinelle-improvements' into 'master'
Variaous little coccinelle improvements See merge request isc-projects/bind9!3025
This commit is contained in:
commit
d72845f01c
11 changed files with 15 additions and 25 deletions
|
|
@ -373,8 +373,7 @@ bdb_cleanup(bdb_instance_t *db) {
|
|||
/* save mctx for later */
|
||||
mctx = db->mctx;
|
||||
/* return, and detach the memory */
|
||||
isc_mem_put(mctx, db, sizeof(bdb_instance_t));
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_putanddetach(&mctx, db, sizeof(bdb_instance_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -463,8 +463,7 @@ bdbhpt_cleanup(bdbhpt_instance_t *db) {
|
|||
/* save mctx for later */
|
||||
mctx = db->mctx;
|
||||
/* return, and detach the memory */
|
||||
isc_mem_put(mctx, db, sizeof(bdbhpt_instance_t));
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_putanddetach(&mctx, db, sizeof(bdbhpt_instance_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -936,10 +936,7 @@ fs_destroy(void *driverarg, void *dbdata)
|
|||
mctx = cd->mctx;
|
||||
|
||||
/* free config data memory */
|
||||
isc_mem_put(mctx, cd, sizeof(config_data_t));
|
||||
|
||||
/* detach memory from context */
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_putanddetach(&mctx, cd, sizeof(config_data_t));
|
||||
}
|
||||
|
||||
static dns_sdlzmethods_t dlz_fs_methods = {
|
||||
|
|
|
|||
|
|
@ -255,8 +255,7 @@ stub_dlz_destroy(void *driverarg, void *dbdata)
|
|||
isc_mem_free(named_g_mctx, cd->myname);
|
||||
isc_mem_free(named_g_mctx, cd->myip);
|
||||
mctx = cd->mctx;
|
||||
isc_mem_put(mctx, cd, sizeof(config_data_t));
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_putanddetach(&mctx, cd, sizeof(config_data_t));
|
||||
}
|
||||
|
||||
static dns_sdlzmethods_t dlz_stub_methods = {
|
||||
|
|
|
|||
|
|
@ -450,8 +450,7 @@ sdlzh_destroy_sqldbinstance(dbinstance_t *dbi)
|
|||
(void) isc_mutex_destroy(&dbi->instance_lock);
|
||||
|
||||
/* return, and detach the memory */
|
||||
isc_mem_put(mctx, dbi, sizeof(dbinstance_t));
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_putanddetach(&mctx, dbi, sizeof(dbinstance_t));
|
||||
}
|
||||
|
||||
char *
|
||||
|
|
|
|||
|
|
@ -669,7 +669,7 @@ make_notify(const char *zone, int *packetlen) {
|
|||
|
||||
/* Question */
|
||||
packet[12] = '.';
|
||||
memcpy(&packet[13], zone, strlen(zone));
|
||||
memmove(&packet[13], zone, strlen(zone));
|
||||
packet[13 + strlen(zone)] = 0;
|
||||
|
||||
/* Make the question into labels */
|
||||
|
|
@ -755,7 +755,7 @@ notify(mysql_data_t *state, const char *zone, int sn) {
|
|||
if (h == NULL)
|
||||
continue;
|
||||
|
||||
memcpy(&addr.sin_addr, h->h_addr, h->h_length);
|
||||
memmove(&addr.sin_addr, h->h_addr, h->h_length);
|
||||
addrp = &addr.sin_addr;
|
||||
|
||||
/* Get the address for the nameserver into a string */
|
||||
|
|
|
|||
|
|
@ -116,14 +116,16 @@ isc_hp_new(isc_mem_t *mctx, size_t max_hps, isc_hp_deletefunc_t *deletefunc) {
|
|||
hp->rl = isc_mem_get(mctx, isc__hp_max_threads * sizeof(hp->rl[0]));
|
||||
|
||||
for (int i = 0; i < isc__hp_max_threads; i++) {
|
||||
hp->hp[i] = isc_mem_get(mctx, CLPAD * 2 * sizeof(hp->hp[i][0]));
|
||||
hp->hp[i] = isc_mem_get(mctx,
|
||||
CLPAD * 2 * sizeof(hp->hp[i][0]));
|
||||
hp->rl[i] = isc_mem_get(mctx, sizeof(*hp->rl[0]));
|
||||
*hp->rl[i] = (retirelist_t) { .size = 0 };
|
||||
|
||||
for (int j = 0; j < hp->max_hps; j++) {
|
||||
atomic_init(&hp->hp[i][j], 0);
|
||||
}
|
||||
hp->rl[i]->list = isc_mem_get(hp->mctx, isc__hp_max_retired * sizeof(uintptr_t));
|
||||
hp->rl[i]->list = isc_mem_get(hp->mctx,
|
||||
isc__hp_max_retired * sizeof(uintptr_t));
|
||||
}
|
||||
|
||||
return (hp);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/types.h>
|
||||
|
|
|
|||
|
|
@ -931,8 +931,7 @@ isc__nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr,
|
|||
sock->ah_frees = isc_mem_allocate(mgr->mctx,
|
||||
sock->ah_size * sizeof(size_t));
|
||||
sock->ah_handles = isc_mem_allocate(mgr->mctx,
|
||||
sock->ah_size *
|
||||
sizeof(isc_nmhandle_t *));
|
||||
sock->ah_size * sizeof(isc_nmhandle_t *));
|
||||
for (size_t i = 0; i < 32; i++) {
|
||||
sock->ah_frees[i] = i;
|
||||
sock->ah_handles[i] = NULL;
|
||||
|
|
|
|||
|
|
@ -2465,8 +2465,8 @@ ns_clientmgr_create(isc_mem_t *mctx, ns_server_t *sctx, isc_taskmgr_t *taskmgr,
|
|||
ns_interface_attach(interface, &manager->interface);
|
||||
|
||||
manager->exiting = false;
|
||||
manager->taskpool =
|
||||
isc_mem_get(mctx, CLIENT_NTASKS*sizeof(isc_task_t *));
|
||||
manager->taskpool = isc_mem_get(mctx,
|
||||
CLIENT_NTASKS * sizeof(isc_task_t *));
|
||||
for (i = 0; i < CLIENT_NTASKS; i++) {
|
||||
manager->taskpool[i] = NULL;
|
||||
isc_task_create(manager->taskmgr, 20, &manager->taskpool[i]);
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ ret=0
|
|||
for spatch in cocci/*.spatch; do
|
||||
patch="$(dirname "$spatch")/$(basename "$spatch" .spatch).patch"
|
||||
: > "$patch"
|
||||
for dir in bin lib fuzz; do
|
||||
spatch --sp-file="$spatch" --use-gitgrep --dir "$dir" --very-quiet --include-headers >> "$patch";
|
||||
done
|
||||
spatch --sp-file "$spatch" --use-gitgrep --dir "." --very-quiet --include-headers "$@" >> "$patch";
|
||||
if [ "$(< "$patch" wc -l)" -gt "0" ]; then
|
||||
cat "$patch"
|
||||
ret=1
|
||||
|
|
|
|||
Loading…
Reference in a new issue