a_addr.s_addr = 0x0100007fU;
- sampledb = isc_mem_getx(mctx, sizeof(*sampledb), ISC_MEM_ZERO);
+ sampledb = isc_mem_get(mctx, sizeof(*sampledb));
+ *sampledb = (sampledb_t){
+ .common.magic = DNS_DB_MAGIC,
+ .common.impmagic = SAMPLEDB_MAGIC,
+ .common.methods = &sampledb_methods,
+ .common.rdclass = rdclass,
+ };
isc_mem_attach(mctx, &sampledb->common.mctx);
dns_name_init(&sampledb->common.origin, NULL);
- sampledb->common.magic = DNS_DB_MAGIC;
- sampledb->common.impmagic = SAMPLEDB_MAGIC;
-
- sampledb->common.methods = &sampledb_methods;
- sampledb->common.attributes = 0;
- sampledb->common.rdclass = rdclass;
-
CHECK(dns_name_dupwithoffsets(origin, mctx, &sampledb->common.origin));
isc_refcount_init(&sampledb->common.references, 1);
REQUIRE(sample_instp != NULL && *sample_instp == NULL);
- sample_instance_t *inst = isc_mem_getx(mctx, sizeof(*inst),
- ISC_MEM_ZERO);
+ sample_instance_t *inst = isc_mem_get(mctx, sizeof(*inst));
+ *inst = (sample_instance_t){ 0 };
+
isc_mem_attach(mctx, &inst->mctx);
inst->db_name = isc_mem_strdup(mctx, db_name);
-
inst->zone1_name = dns_fixedname_initname(&inst->zone1_fn);
inst->zone2_name = dns_fixedname_initname(&inst->zone2_fn);
DNS_RDATACOMMON_INIT(&ptr_struct, dns_rdatatype_ptr, dns_rdataclass_in);
dns_name_init(&ptr_struct.ptr, NULL);
- syncptr = isc_mem_getx(mctx, sizeof(*syncptr), ISC_MEM_ZERO);
+ syncptr = isc_mem_get(mctx, sizeof(*syncptr));
+ *syncptr = (syncptr_t){ 0 };
isc_mem_attach(mctx, &syncptr->mctx);
isc_buffer_init(&syncptr->b, syncptr->buf, sizeof(syncptr->buf));
dns_fixedname_init(&syncptr->ptr_target_name);
+++ /dev/null
-@@
-expression ptr, ctx, size;
-@@
-
-- ptr = isc_mem_get(ctx, size);
-+ ptr = isc_mem_getx(ctx, size, ISC_MEM_ZERO);
-...
-- memset(ptr, 0, size);
-
-@@
-expression ptr, ctx, size;
-@@
-
-- ptr = isc_mem_allocate(ctx, size);
-+ ptr = isc_mem_allocatex(ctx, size, ISC_MEM_ZERO);
-...
-- memset(ptr, 0, size);
REQUIRE(src != NULL);
REQUIRE(destp != NULL && *destp == NULL);
- d = isc_mem_getx(mctx, sizeof(*d), ISC_MEM_ZERO);
+ d = isc_mem_get(mctx, sizeof(*d));
+ *d = (dns_dtdata_t){ 0 };
+
isc_mem_attach(mctx, &d->mctx);
d->frame = dnstap__dnstap__unpack(NULL, src->length, src->base);
void
dns_ipkeylist_clear(isc_mem_t *mctx, dns_ipkeylist_t *ipkl) {
- uint32_t i;
-
REQUIRE(ipkl != NULL);
if (ipkl->allocated == 0) {
if (ipkl->addrs != NULL) {
isc_mem_cput(mctx, ipkl->addrs, ipkl->allocated,
- sizeof(isc_sockaddr_t));
+ sizeof(ipkl->addrs[0]));
}
if (ipkl->sources != NULL) {
isc_mem_cput(mctx, ipkl->sources, ipkl->allocated,
- sizeof(isc_sockaddr_t));
- }
-
- if (ipkl->addrs != NULL) {
- isc_mem_cput(mctx, ipkl->addrs, ipkl->allocated,
- sizeof(isc_sockaddr_t));
+ sizeof(ipkl->sources[0]));
}
if (ipkl->keys != NULL) {
- for (i = 0; i < ipkl->allocated; i++) {
- if (ipkl->keys[i] == NULL) {
- continue;
- }
- if (dns_name_dynamic(ipkl->keys[i])) {
- dns_name_free(ipkl->keys[i], mctx);
+ for (size_t i = 0; i < ipkl->allocated; i++) {
+ if (ipkl->keys[i] != NULL) {
+ if (dns_name_dynamic(ipkl->keys[i])) {
+ dns_name_free(ipkl->keys[i], mctx);
+ }
+ isc_mem_put(mctx, ipkl->keys[i],
+ sizeof(*ipkl->keys[i]));
}
- isc_mem_put(mctx, ipkl->keys[i], sizeof(dns_name_t));
}
isc_mem_cput(mctx, ipkl->keys, ipkl->allocated,
- sizeof(dns_name_t *));
+ sizeof(ipkl->keys[0]));
}
if (ipkl->tlss != NULL) {
- for (i = 0; i < ipkl->allocated; i++) {
- if (ipkl->tlss[i] == NULL) {
- continue;
+ for (size_t i = 0; i < ipkl->allocated; i++) {
+ if (ipkl->tlss[i] != NULL) {
+ if (dns_name_dynamic(ipkl->tlss[i])) {
+ dns_name_free(ipkl->tlss[i], mctx);
+ }
+ isc_mem_put(mctx, ipkl->tlss[i],
+ sizeof(*ipkl->tlss[i]));
}
- if (dns_name_dynamic(ipkl->tlss[i])) {
- dns_name_free(ipkl->tlss[i], mctx);
- }
- isc_mem_put(mctx, ipkl->tlss[i], sizeof(dns_name_t));
}
isc_mem_cput(mctx, ipkl->tlss, ipkl->allocated,
- sizeof(dns_name_t *));
+ sizeof(ipkl->tlss[0]));
}
if (ipkl->labels != NULL) {
- for (i = 0; i < ipkl->allocated; i++) {
- if (ipkl->labels[i] == NULL) {
- continue;
- }
- if (dns_name_dynamic(ipkl->labels[i])) {
- dns_name_free(ipkl->labels[i], mctx);
+ for (size_t i = 0; i < ipkl->allocated; i++) {
+ if (ipkl->labels[i] != NULL) {
+ if (dns_name_dynamic(ipkl->labels[i])) {
+ dns_name_free(ipkl->labels[i], mctx);
+ }
+ isc_mem_put(mctx, ipkl->labels[i],
+ sizeof(*ipkl->labels[i]));
}
- isc_mem_put(mctx, ipkl->labels[i], sizeof(dns_name_t));
}
isc_mem_cput(mctx, ipkl->labels, ipkl->allocated,
- sizeof(dns_name_t *));
+ sizeof(ipkl->labels[0]));
}
dns_ipkeylist_init(ipkl);
}
ipkl->addrs = isc_mem_creget(mctx, ipkl->addrs, ipkl->allocated, n,
- sizeof(isc_sockaddr_t));
- ipkl->sources = isc_mem_creget(mctx, ipkl->addrs, ipkl->allocated, n,
- sizeof(isc_sockaddr_t));
- ipkl->keys = isc_mem_creget(mctx, ipkl->addrs, ipkl->allocated, n,
- sizeof(dns_name_t *));
- ipkl->tlss = isc_mem_creget(mctx, ipkl->addrs, ipkl->allocated, n,
- sizeof(dns_name_t *));
- ipkl->labels = isc_mem_creget(mctx, ipkl->addrs, ipkl->allocated, n,
- sizeof(dns_name_t *));
+ sizeof(ipkl->addrs[0]));
+ ipkl->sources = isc_mem_creget(mctx, ipkl->sources, ipkl->allocated, n,
+ sizeof(ipkl->sources[0]));
+ ipkl->keys = isc_mem_creget(mctx, ipkl->keys, ipkl->allocated, n,
+ sizeof(ipkl->keys[0]));
+ ipkl->tlss = isc_mem_creget(mctx, ipkl->tlss, ipkl->allocated, n,
+ sizeof(ipkl->tlss[0]));
+ ipkl->labels = isc_mem_creget(mctx, ipkl->labels, ipkl->allocated, n,
+ sizeof(ipkl->labels[0]));
ipkl->allocated = n;
return (ISC_R_SUCCESS);
size = sizeof(journal_rawheader_t) +
ISC_CHECKED_MUL(index_size, sizeof(journal_rawpos_t));
- mem = isc_mem_getx(mctx, size, ISC_MEM_ZERO);
+ mem = isc_mem_cget(mctx, 1, size);
memmove(mem, &rawheader, sizeof(rawheader));
result = isc_stdio_write(mem, 1, (size_t)size, fp, NULL);
static dns_glue_t *
new_gluelist(isc_mem_t *mctx, dns_name_t *name) {
- dns_glue_t *glue = isc_mem_getx(mctx, sizeof(*glue), ISC_MEM_ZERO);
+ dns_glue_t *glue = isc_mem_get(mctx, sizeof(*glue));
+ *glue = (dns_glue_t){ 0 };
dns_name_t *gluename = dns_fixedname_initname(&glue->fixedname);
isc_mem_attach(mctx, &glue->mctx);
* Allocate space for the node structure, the name, and the offsets.
*/
nodelen = sizeof(dns_rbtnode_t) + region.length + labels + 1;
- node = isc_mem_getx(mctx, nodelen, ISC_MEM_ZERO);
-
- node->is_root = 0;
- node->parent = NULL;
- node->right = NULL;
- node->left = NULL;
- node->down = NULL;
- node->data = NULL;
-
- node->hashnext = NULL;
- node->hashval = 0;
+ node = isc_mem_get(mctx, nodelen);
+ *node = (dns_rbtnode_t){
+ .nsec = DNS_RBT_NSEC_NORMAL,
+ .color = BLACK,
+ };
ISC_LINK_INIT(node, deadlink);
- node->locknum = 0;
- node->wild = 0;
- node->dirty = 0;
isc_refcount_init(&node->references, 0);
- node->find_callback = 0;
- node->nsec = DNS_RBT_NSEC_NORMAL;
-
- node->color = BLACK;
/*
* The following is stored to make reconstructing a name from the
* Allocate the memory, set up a buffer, start copying in
* data.
*/
- rawbuf = isc_mem_getx(mctx, buflen, ISC_MEM_ZERO);
+ rawbuf = isc_mem_cget(mctx, 1, buflen);
#if DNS_RDATASET_FIXED
/* Allocate temporary offset table. */
dns_resolver_disable_ds_digest(dns_resolver_t *resolver, const dns_name_t *name,
unsigned int digest_type) {
unsigned int len, mask;
- unsigned char *tmp;
- unsigned char *digests;
isc_result_t result;
dns_rbtnode_t *node = NULL;
result = dns_rbt_addnode(resolver->digests, name, &node);
if (result == ISC_R_SUCCESS || result == ISC_R_EXISTS) {
- digests = node->data;
+ unsigned char *digests = node->data;
/* If digests is set, digests[0] contains its length. */
if (digests == NULL || len > *digests) {
/*
* bitfield and copy the old (smaller) bitfield
* into it if one exists.
*/
- tmp = isc_mem_getx(resolver->mctx, len, ISC_MEM_ZERO);
+ unsigned char *tmp = isc_mem_cget(resolver->mctx, 1,
+ len);
if (digests != NULL) {
memmove(tmp, digests, *digests);
}
bsize = sizeof(dns_rrl_block_t) +
ISC_CHECKED_MUL((newsize - 1), sizeof(dns_rrl_entry_t));
- b = isc_mem_getx(rrl->mctx, bsize, ISC_MEM_ZERO);
+ b = isc_mem_cget(rrl->mctx, 1, bsize);
b->size = bsize;
e = b->entries;
hsize = sizeof(dns_rrl_hash_t) +
ISC_CHECKED_MUL((new_bins - 1), sizeof(hash->bins[0]));
- hash = isc_mem_getx(rrl->mctx, hsize, ISC_MEM_ZERO);
+ hash = isc_mem_cget(rrl->mctx, 1, hsize);
hash->length = new_bins;
rrl->hash_gen ^= 1;
hash->gen = rrl->hash_gen;
*rrlp = NULL;
- rrl = isc_mem_getx(view->mctx, sizeof(*rrl), ISC_MEM_ZERO);
+ rrl = isc_mem_get(view->mctx, sizeof(*rrl));
+ *rrl = (dns_rrl_t){
+ .ts_bases[0] = isc_stdtime_now(),
+ };
isc_mem_attach(view->mctx, &rrl->mctx);
isc_mutex_init(&rrl->lock);
- rrl->ts_bases[0] = isc_stdtime_now();
view->rrl = rrl;
len = sizeof(*element) + nsec3->next_length * 2 + nsec3->salt_length;
- element = isc_mem_getx(vctx->mctx, len, ISC_MEM_ZERO);
- element->hash = nsec3->hash;
- element->salt_length = nsec3->salt_length;
- element->next_length = nsec3->next_length;
- element->iterations = nsec3->iterations;
+ element = isc_mem_get(vctx->mctx, len);
+ *element = (struct nsec3_chain_fixed){
+ .hash = nsec3->hash,
+ .salt_length = nsec3->salt_length,
+ .next_length = nsec3->next_length,
+ .iterations = nsec3->iterations,
+ };
cp = (unsigned char *)(element + 1);
memmove(cp, nsec3->salt, nsec3->salt_length);
cp += nsec3->salt_length;
uint size = isc_tid_count();
INSIST(size > 0);
- isc_histomulti_t *hm = isc_mem_getx(
- mctx, STRUCT_FLEX_SIZE(hm, hg, size), ISC_MEM_ZERO);
+ isc_histomulti_t *hm = isc_mem_cget(mctx, 1,
+ STRUCT_FLEX_SIZE(hm, hg, size));
*hm = (isc_histomulti_t){
.magic = HISTOMULTI_MAGIC,
.size = size,
*/
/*%
- * Flags that can be passed to isc_mem_*x() variants of the macros.
- *
* The definitions of the macros have been pulled directly from jemalloc.h
* and checked for consistency in mem.c.
*
- *\li ISC_MEM_ZERO - fill the memory with zeroes before returning
+ *\li ISC__MEM_ZERO - fill the memory with zeroes before returning
*/
-#define ISC_MEM_ZERO ((int)0x40)
+#define ISC__MEM_ZERO ((int)0x40)
#define isc_mem_get(c, s) isc__mem_get((c), (s), 0 _ISC_MEM_FILELINE)
#define isc_mem_cget(c, n, s) \
isc__mem_get((c), ISC_CHECKED_MUL((n), (s)), \
- ISC_MEM_ZERO _ISC_MEM_FILELINE)
-#define isc_mem_getx(c, s, f) isc__mem_get((c), (s), (f)_ISC_MEM_FILELINE)
+ ISC__MEM_ZERO _ISC_MEM_FILELINE)
#define isc_mem_reget(c, p, o, n) \
isc__mem_reget((c), (p), (o), (n), 0 _ISC_MEM_FILELINE)
#define isc_mem_creget(c, p, o, n, s) \
isc__mem_reget((c), (p), ISC_CHECKED_MUL((o), (s)), \
ISC_CHECKED_MUL((n), (s)), \
- ISC_MEM_ZERO _ISC_MEM_FILELINE)
-#define isc_mem_regetx(c, p, o, n, f) \
- isc__mem_reget((c), (p), (o), (n), (f)_ISC_MEM_FILELINE)
+ ISC__MEM_ZERO _ISC_MEM_FILELINE)
#define isc_mem_allocate(c, s) isc__mem_allocate((c), (s), 0 _ISC_MEM_FILELINE)
-#define isc_mem_allocatex(c, s, f) \
- isc__mem_allocate((c), (s), (f)_ISC_MEM_FILELINE)
#define isc_mem_callocate(c, n, s) \
isc__mem_allocate((c), ISC_CHECKED_MUL((n), (s)), \
- ISC_MEM_ZERO _ISC_MEM_FILELINE)
+ ISC__MEM_ZERO _ISC_MEM_FILELINE)
#define isc_mem_reallocate(c, p, s) \
isc__mem_reallocate((c), (p), (s), 0 _ISC_MEM_FILELINE)
-#define isc_mem_reallocatex(c, p, s, f) \
- isc__mem_reallocate((c), (p), (s), (f)_ISC_MEM_FILELINE)
#define isc_mem_strdup(c, p) isc__mem_strdup((c), (p)_ISC_MEM_FILELINE)
#define isc_mem_strndup(c, p, l) \
isc__mem_strndup((c), (p), (l)_ISC_MEM_FILELINE)
#define isc_mem_cput(c, p, n, s) \
do { \
isc__mem_put((c), (p), ISC_CHECKED_MUL((n), (s)), \
- ISC_MEM_ZERO _ISC_MEM_FILELINE); \
+ ISC__MEM_ZERO _ISC_MEM_FILELINE); \
(p) = NULL; \
} while (0)
-#define isc_mem_putx(c, p, s, f) \
- do { \
- isc__mem_put((c), (p), (s), (f)_ISC_MEM_FILELINE); \
- (p) = NULL; \
- } while (0)
#define isc_mem_putanddetach(c, p, s) \
do { \
isc__mem_putanddetach((c), (p), (s), 0 _ISC_MEM_FILELINE); \
(p) = NULL; \
} while (0)
-#define isc_mem_putanddetachx(c, p, s, f) \
- do { \
- isc__mem_putanddetach((c), (p), (s), (f)_ISC_MEM_FILELINE); \
- (p) = NULL; \
- } while (0)
#define isc_mem_free(c, p) \
do { \
isc__mem_free((c), (p), 0 _ISC_MEM_FILELINE); \
(p) = NULL; \
} while (0)
-#define isc_mem_freex(c, p, f) \
- do { \
- isc__mem_free((c), (p), (f)_ISC_MEM_FILELINE); \
- (p) = NULL; \
- } while (0)
#define isc_mempool_put(c, p) \
do { \
isc__mempool_put((c), (p)_ISC_MEM_FILELINE); \
ret = mallocx(size, flags);
INSIST(ret != NULL);
- if ((flags & ISC_MEM_ZERO) == 0 && (ctx->flags & ISC_MEMFLAG_FILL) != 0)
+ if ((flags & ISC__MEM_ZERO) == 0 &&
+ (ctx->flags & ISC_MEMFLAG_FILL) != 0)
{
memset(ret, 0xbe, size); /* Mnemonic for "beef". */
}
new_ptr = rallocx(old_ptr, new_size, flags);
INSIST(new_ptr != NULL);
- if ((flags & ISC_MEM_ZERO) == 0 && (ctx->flags & ISC_MEMFLAG_FILL) != 0)
+ if ((flags & ISC__MEM_ZERO) == 0 &&
+ (ctx->flags & ISC_MEMFLAG_FILL) != 0)
{
ssize_t diff_size = new_size - old_size;
void *diff_ptr = (uint8_t *)new_ptr + old_size;
* Check if the values copied from jemalloc still match
*/
#ifdef JEMALLOC_API_SUPPORTED
- RUNTIME_CHECK(ISC_MEM_ZERO == MALLOCX_ZERO);
+ RUNTIME_CHECK(ISC__MEM_ZERO == MALLOCX_ZERO);
#endif /* JEMALLOC_API_SUPPORTED */
isc_mutex_init(&contextslock);
for (size_t i = 0; i < isc_loopmgr_nloops(loopmgr); i++) {
isc__networker_t *worker =
&listener->worker->netmgr->workers[i];
- http_endpoints_data_t *data = isc_mem_getx(
- worker->loop->mctx, sizeof(*data), ISC_MEM_ZERO);
+ http_endpoints_data_t *data = isc_mem_cget(worker->loop->mctx,
+ 1, sizeof(*data));
isc__nmsocket_attach(listener, &data->listener);
isc_nm_http_endpoints_attach(eps, &data->endpoints);
for (size_t i = 0; i < nworkers; i++) {
isc__networker_t *worker =
&listener->worker->netmgr->workers[i];
- settlsctx_data_t *data = isc_mem_getx(
- worker->loop->mctx, sizeof(*data), ISC_MEM_ZERO);
+ settlsctx_data_t *data = isc_mem_cget(worker->loop->mctx, 1,
+ sizeof(*data));
isc__nmsocket_attach(listener, &data->listener);
isc_tlsctx_attach(tlsctx, &data->tlsctx);
uint32_t nloops = isc_loopmgr_nloops(loopmgr);
size_t bytes = sizeof(struct bench_state) +
sizeof(struct thread_args) * nloops;
- struct bench_state *bctx = isc_mem_getx(mctx, bytes, ISC_MEM_ZERO);
+ struct bench_state *bctx = isc_mem_cget(mctx, 1, bytes);
*bctx = (struct bench_state){
.loopmgr = loopmgr,
uint32_t nloops = isc_loopmgr_nloops(loopmgr);
for (uint32_t i = 0; i < nloops; i++) {
isc_loop_t *loop = isc_loop_get(loopmgr, i);
- struct ticker *ticker = isc_mem_getx(mctx, sizeof(*ticker),
- ISC_MEM_ZERO);
+ struct ticker *ticker = isc_mem_get(mctx, sizeof(*ticker));
+ *ticker = (struct ticker){
+ .loopmgr = loopmgr,
+ };
isc_mem_attach(mctx, &ticker->mctx);
- ticker->loopmgr = loopmgr;
isc_loop_setup(loop, start_ticker, ticker);
isc_loop_teardown(loop, stop_ticker, ticker);
}
}
/* zeroed memory system tests */
-ISC_RUN_TEST_IMPL(isc_mem_get_zero) {
+ISC_RUN_TEST_IMPL(isc_mem_cget_zero) {
uint8_t *ptr;
bool zeroed;
uint8_t expected[4096] = { 0 };
return;
}
- ptr = isc_mem_getx(mctx, sizeof(expected), ISC_MEM_ZERO);
+ ptr = isc_mem_cget(mctx, 1, sizeof(expected));
assert_memory_equal(ptr, expected, sizeof(expected));
isc_mem_put(mctx, ptr, sizeof(expected));
}
-ISC_RUN_TEST_IMPL(isc_mem_allocate_zero) {
+ISC_RUN_TEST_IMPL(isc_mem_callocate_zero) {
uint8_t *ptr;
bool zeroed;
uint8_t expected[4096] = { 0 };
return;
}
- ptr = isc_mem_allocatex(mctx, sizeof(expected), ISC_MEM_ZERO);
+ ptr = isc_mem_callocate(mctx, 1, sizeof(expected));
assert_memory_equal(ptr, expected, sizeof(expected));
isc_mem_free(mctx, ptr);
}
isc_mem_put(mctx, data, REGET_SHRINK_SIZE);
}
-ISC_RUN_TEST_IMPL(isc_mem_reallocatex) {
+ISC_RUN_TEST_IMPL(isc_mem_reallocate) {
uint8_t *data = NULL;
/* test that we can reallocate NULL */
- data = isc_mem_reallocatex(mctx, NULL, REGET_INIT_SIZE, 0);
+ data = isc_mem_reallocate(mctx, NULL, REGET_INIT_SIZE);
assert_non_null(data);
isc_mem_free(mctx, data);
/* test that we can re-get a zero-length allocation */
- data = isc_mem_allocatex(mctx, 0, 0);
+ data = isc_mem_allocate(mctx, 0);
assert_non_null(data);
- data = isc_mem_reallocatex(mctx, data, REGET_INIT_SIZE, 0);
+ data = isc_mem_reallocate(mctx, data, REGET_INIT_SIZE);
assert_non_null(data);
for (size_t i = 0; i < REGET_INIT_SIZE; i++) {
data[i] = i % UINT8_MAX;
}
- data = isc_mem_reallocatex(mctx, data, REGET_GROW_SIZE, 0);
+ data = isc_mem_reallocate(mctx, data, REGET_GROW_SIZE);
assert_non_null(data);
for (size_t i = 0; i < REGET_INIT_SIZE; i++) {
data[i - 1] = i % UINT8_MAX;
}
- data = isc_mem_reallocatex(mctx, data, REGET_SHRINK_SIZE, 0);
+ data = isc_mem_reallocate(mctx, data, REGET_SHRINK_SIZE);
assert_non_null(data);
for (size_t i = REGET_SHRINK_SIZE; i > 0; i--) {
ISC_TEST_LIST_START
ISC_TEST_ENTRY(isc_mem_get)
-ISC_TEST_ENTRY(isc_mem_get_zero)
-ISC_TEST_ENTRY(isc_mem_allocate_zero)
+ISC_TEST_ENTRY(isc_mem_cget_zero)
+ISC_TEST_ENTRY(isc_mem_callocate_zero)
ISC_TEST_ENTRY(isc_mem_inuse)
ISC_TEST_ENTRY(isc_mem_zeroget)
ISC_TEST_ENTRY(isc_mem_reget)
-ISC_TEST_ENTRY(isc_mem_reallocatex)
+ISC_TEST_ENTRY(isc_mem_reallocate)
#if ISC_MEM_TRACKLINES
ISC_TEST_ENTRY(isc_mem_noflags)
ISC_LOOP_TEST_SETUP_TEARDOWN_IMPL(ratelimiter_enqueue) {
isc_result_t result;
- rlstat_t *rlstat = isc_mem_getx(mctx, sizeof(*rlstat), ISC_MEM_ZERO);
+ rlstat_t *rlstat = isc_mem_get(mctx, sizeof(*rlstat));
+ *rlstat = (rlstat_t){ 0 };
result = isc_ratelimiter_enqueue(rl, mainloop, tick, rlstat,
&rlstat->event);
}
ISC_LOOP_TEST_SETUP_TEARDOWN_IMPL(ratelimiter_enqueue_shutdown) {
- rlstat_t *rlstat = isc_mem_getx(mctx, sizeof(*rlstat), ISC_MEM_ZERO);
isc_rlevent_t *event = NULL;
+ rlstat_t *rlstat = isc_mem_get(mctx, sizeof(*rlstat));
+ *rlstat = (rlstat_t){ 0 };
expect_assert_failure(
isc_ratelimiter_enqueue(NULL, mainloop, tick, NULL, &event));
}
ISC_LOOP_TEST_SETUP_TEARDOWN_IMPL(ratelimiter_dequeue) {
- rlstat_t *rlstat = isc_mem_getx(mctx, sizeof(*rlstat), ISC_MEM_ZERO);
isc_rlevent_t *fake = isc_mem_get(mctx, sizeof(*fake));
+ rlstat_t *rlstat = isc_mem_get(mctx, sizeof(*rlstat));
+ *rlstat = (rlstat_t){ 0 };
assert_int_equal(isc_ratelimiter_enqueue(rl, mainloop, tick, rlstat,
&rlstat->event),
isc_ratelimiter_setpertic(rl, 1);
isc_ratelimiter_setpushpop(rl, false);
- rlstat = isc_mem_getx(mctx, sizeof(*rlstat), ISC_MEM_ZERO);
+ rlstat = isc_mem_get(mctx, sizeof(*rlstat));
+ *rlstat = (rlstat_t){ 0 };
assert_int_equal(isc_ratelimiter_enqueue(rl, mainloop, tock, rlstat,
&rlstat->event),
ISC_R_SUCCESS);
- rlstat = isc_mem_getx(mctx, sizeof(*rlstat), ISC_MEM_ZERO);
+ rlstat = isc_mem_get(mctx, sizeof(*rlstat));
+ *rlstat = (rlstat_t){ 0 };
assert_int_equal(isc_ratelimiter_enqueue(rl, mainloop, tick, rlstat,
&rlstat->event),
ISC_R_SUCCESS);
isc_ratelimiter_setpertic(rl, 2);
isc_ratelimiter_setpushpop(rl, true);
- rlstat = isc_mem_getx(mctx, sizeof(*rlstat), ISC_MEM_ZERO);
+ rlstat = isc_mem_get(mctx, sizeof(*rlstat));
+ *rlstat = (rlstat_t){ 0 };
assert_int_equal(isc_ratelimiter_enqueue(rl, mainloop, tock, rlstat,
&rlstat->event),
ISC_R_SUCCESS);
- rlstat = isc_mem_getx(mctx, sizeof(*rlstat), ISC_MEM_ZERO);
+ rlstat = isc_mem_get(mctx, sizeof(*rlstat));
+ *rlstat = (rlstat_t){ 0 };
assert_int_equal(isc_ratelimiter_enqueue(rl, mainloop, tick, rlstat,
&rlstat->event),
ISC_R_SUCCESS);