mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Megacommit of many files.
Mostly, several functions that take pointers as arguments, almost always char * pointers, had those pointers qualified with "const". Those that returned pointers to previously const-qualified arguments had their return values qualified as const. Some structure members were qualified as const to retain that attribute from the variables from which they were assigned. The macro DE_CONST was added to isc/util.h to deal with a handful of very special places where something is qualified as const but really needs to have its const qualifier removed. Also cleaned up a few places where variable names clashed with reserved identifiers. (Which mostly works fine, but strictly speaking is undefined by the standard.) Minor other ISC style cleanups.
This commit is contained in:
@@ -214,7 +214,7 @@ destroy(isc_timer_t *timer) {
|
||||
isc_result_t
|
||||
isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
|
||||
isc_time_t *expires, isc_interval_t *interval,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
isc_task_t *task, isc_taskaction_t action, const void *arg,
|
||||
isc_timer_t **timerp)
|
||||
{
|
||||
isc_timer_t *timer;
|
||||
@@ -281,7 +281,17 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
|
||||
timer->task = NULL;
|
||||
isc_task_attach(task, &timer->task);
|
||||
timer->action = action;
|
||||
timer->arg = arg;
|
||||
/*
|
||||
* Removing the const attribute from "arg" is the best of two
|
||||
* evils here. If the timer->arg member is made const, then
|
||||
* it affects a great many recipients of the timer event
|
||||
* which did not pass in an "arg" that was truly const.
|
||||
* Changing isc_timer_create() to not have "arg" prototyped as const,
|
||||
* though, can cause compilers warnings for calls that *do*
|
||||
* have a truly const arg. The caller will have to carefully
|
||||
* keep track of whether arg started as a true const.
|
||||
*/
|
||||
DE_CONST(arg, timer->arg);
|
||||
timer->index = 0;
|
||||
if (isc_mutex_init(&timer->lock) != ISC_R_SUCCESS) {
|
||||
isc_task_detach(&timer->task);
|
||||
|
Reference in New Issue
Block a user