mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 12:00:00 -04:00
Address cppcheck reports
This commit is contained in:
parent
b396c9dfde
commit
fcebc4f15b
5 changed files with 25 additions and 33 deletions
|
|
@ -332,17 +332,15 @@ totext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) {
|
|||
*/
|
||||
if ((ctx->style.flags & DNS_STYLEFLAG_MULTILINE) != 0) {
|
||||
isc_buffer_t buf;
|
||||
isc_region_t r;
|
||||
unsigned int col = 0;
|
||||
|
||||
isc_buffer_init(&buf, ctx->linebreak_buf,
|
||||
sizeof(ctx->linebreak_buf));
|
||||
|
||||
isc_buffer_availableregion(&buf, &r);
|
||||
if (r.length < 1)
|
||||
if (isc_buffer_availablelength(&buf) < 1) {
|
||||
return (DNS_R_TEXTTOOLONG);
|
||||
r.base[0] = '\n';
|
||||
isc_buffer_add(&buf, 1);
|
||||
}
|
||||
isc_buffer_putuint8(&buf, '\n');
|
||||
|
||||
if ((ctx->style.flags & DNS_STYLEFLAG_INDENT) != 0 ||
|
||||
(ctx->style.flags & DNS_STYLEFLAG_YAML) != 0)
|
||||
|
|
@ -356,11 +354,10 @@ totext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) {
|
|||
}
|
||||
|
||||
if ((ctx->style.flags & DNS_STYLEFLAG_COMMENTDATA) != 0) {
|
||||
isc_buffer_availableregion(&buf, &r);
|
||||
if (r.length < 1)
|
||||
if (isc_buffer_availablelength(&buf) < 1) {
|
||||
return (DNS_R_TEXTTOOLONG);
|
||||
r.base[0] = ';';
|
||||
isc_buffer_add(&buf, 1);
|
||||
}
|
||||
isc_buffer_putuint8(&buf, ';');
|
||||
}
|
||||
|
||||
result = indent(&col, ctx->style.rdata_column,
|
||||
|
|
@ -377,11 +374,10 @@ totext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) {
|
|||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
isc_buffer_availableregion(&buf, &r);
|
||||
if (r.length < 1)
|
||||
if (isc_buffer_availablelength(&buf) < 1) {
|
||||
return (DNS_R_TEXTTOOLONG);
|
||||
r.base[0] = '\0';
|
||||
isc_buffer_add(&buf, 1);
|
||||
}
|
||||
isc_buffer_putuint8(&buf, '\0');
|
||||
ctx->linebreak = ctx->linebreak_buf;
|
||||
} else {
|
||||
ctx->linebreak = NULL;
|
||||
|
|
@ -671,7 +667,6 @@ rdataset_totext(dns_rdataset_t *rdataset,
|
|||
break;
|
||||
} else {
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
isc_region_t r;
|
||||
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
|
||||
|
|
@ -684,11 +679,10 @@ rdataset_totext(dns_rdataset_t *rdataset,
|
|||
ctx->linebreak,
|
||||
target));
|
||||
|
||||
isc_buffer_availableregion(target, &r);
|
||||
if (r.length < 1)
|
||||
if (isc_buffer_availablelength(target) < 1) {
|
||||
return (ISC_R_NOSPACE);
|
||||
r.base[0] = '\n';
|
||||
isc_buffer_add(target, 1);
|
||||
}
|
||||
isc_buffer_putuint8(target, '\n');
|
||||
}
|
||||
|
||||
first = false;
|
||||
|
|
@ -726,7 +720,6 @@ question_totext(dns_rdataset_t *rdataset,
|
|||
{
|
||||
unsigned int column;
|
||||
isc_result_t result;
|
||||
isc_region_t r;
|
||||
|
||||
REQUIRE(DNS_RDATASET_VALID(rdataset));
|
||||
result = dns_rdataset_first(rdataset);
|
||||
|
|
@ -775,11 +768,10 @@ question_totext(dns_rdataset_t *rdataset,
|
|||
column += (target->used - type_start);
|
||||
}
|
||||
|
||||
isc_buffer_availableregion(target, &r);
|
||||
if (r.length < 1)
|
||||
if (isc_buffer_availablelength(target) < 1) {
|
||||
return (ISC_R_NOSPACE);
|
||||
r.base[0] = '\n';
|
||||
isc_buffer_add(target, 1);
|
||||
}
|
||||
isc_buffer_putuint8(target, '\n');
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ default_memalloc(void *arg, size_t size) {
|
|||
if (size == 0U) {
|
||||
size = 1;
|
||||
}
|
||||
/* cppcheck-suppress leakNoVarFunctionCall */
|
||||
return (malloc(size));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ default_memalloc(void *arg, size_t size) {
|
|||
if (size == 0U) {
|
||||
size = 1;
|
||||
}
|
||||
/* cppcheck-suppress leakNoVarFunctionCall */
|
||||
return (malloc(size));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ enum {
|
|||
};
|
||||
|
||||
typedef struct isc__appctx {
|
||||
isc_appctx_t common;
|
||||
isc_mem_t *mctx;
|
||||
isc_eventlist_t on_run;
|
||||
isc_mutex_t lock;
|
||||
isc_appctx_t common;
|
||||
isc_mem_t *mctx;
|
||||
isc_eventlist_t on_run;
|
||||
isc_mutex_t lock;
|
||||
bool shutdown_requested;
|
||||
bool running;
|
||||
/*
|
||||
|
|
@ -71,11 +71,11 @@ typedef struct isc__appctx {
|
|||
|
||||
bool blocked;
|
||||
|
||||
HANDLE hEvents[NUM_EVENTS];
|
||||
HANDLE hEvents[NUM_EVENTS];
|
||||
|
||||
isc_taskmgr_t *taskmgr;
|
||||
isc_socketmgr_t *socketmgr;
|
||||
isc_timermgr_t *timermgr;
|
||||
isc_taskmgr_t *taskmgr;
|
||||
isc_socketmgr_t *socketmgr;
|
||||
isc_timermgr_t *timermgr;
|
||||
} isc__appctx_t;
|
||||
|
||||
static isc__appctx_t isc_g_appctx;
|
||||
|
|
@ -88,7 +88,6 @@ static isc_thread_t main_thread;
|
|||
isc_result_t
|
||||
isc_app_ctxstart(isc_appctx_t *ctx0) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(VALID_APPCTX(ctx));
|
||||
|
||||
|
|
|
|||
|
|
@ -2508,7 +2508,6 @@ isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
|||
unsigned int maxsocks, int nthreads)
|
||||
{
|
||||
isc_socketmgr_t *manager;
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(managerp != NULL && *managerp == NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue