Simplify isc_mem_create() to always use defaults and never fail
Previously, the isc_mem_create() and isc_mem_createx() functions took `max_size` and `target_size` as first two arguments. Those values were never used in the BIND 9 code. The refactoring removes those arguments and let BIND 9 always use the default values. Previously, the isc_mem_create() and isc_mem_createx() functions could have failed because of failed memory allocation. As this was no longer true and the functions have always returned ISC_R_SUCCESS, the have been refactored to return void.
This commit is contained in:
@@ -504,7 +504,7 @@ memory has not been freed when BIND shuts down.
|
||||
To create a basic memory context, use:
|
||||
|
||||
isc_mem_t *mctx = NULL;
|
||||
result = isc_mem_create(0, 0, &mctx);
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
(The zeroes are tuning parameters, `max_size` and `target_size`: Any
|
||||
allocations smaller than `max_size` will be satisfied by getting
|
||||
@@ -1069,9 +1069,10 @@ the following steps need to be taken to initialize it.
|
||||
isc_log_t *lctx;
|
||||
isc_logconfig_t *lcfg;
|
||||
|
||||
if (isc_mem_create(0, 0, &mctx) != ISC_R_SUCCESS) ||
|
||||
isc_log_create(mctx, &lctx, &lcfg) != ISC_R_SUCCESS))
|
||||
isc_mem_create(&mctx);
|
||||
if (isc_log_create(mctx, &lctx, &lcfg) != ISC_R_SUCCESS)) {
|
||||
oops_it_didnt_work();
|
||||
}
|
||||
|
||||
1. Initalize any additional libraries. The convention for the name of
|
||||
the initialization function is `{library}_log_init()`, with a pointer to
|
||||
|
||||
Reference in New Issue
Block a user