minor cleanups

- removed some commented-out code
- cleaned up uses of pval and ival that were not needed
This commit is contained in:
Evan Hunt 2023-09-27 13:01:43 -07:00
parent 5259648b3f
commit d71ebd2086
2 changed files with 6 additions and 13 deletions

View file

@ -57,8 +57,7 @@ smallname_offsets(void *pval, uint32_t ival) {
}
static void
smallname_from_name(/* isc_mem_t *mctx, */ const dns_name_t *name, void **valp,
uint32_t *ctxp) {
smallname_from_name(const dns_name_t *name, void **valp, uint32_t *ctxp) {
size_t size = sizeof(isc_refcount_t) + name->length + name->labels;
*valp = isc_mem_get(mctx, size);
*ctxp = name->labels << 8 | name->length;
@ -68,7 +67,7 @@ smallname_from_name(/* isc_mem_t *mctx, */ const dns_name_t *name, void **valp,
}
static void
smallname_free(/* isc_mem_t *mctx, */ void *pval, uint32_t ival) {
smallname_free(void *pval, uint32_t ival) {
size_t size = sizeof(isc_refcount_t);
size += smallname_length(pval, ival) + smallname_labels(pval, ival);
isc_mem_put(mctx, pval, size);

View file

@ -125,8 +125,6 @@ random_byte(void) {
static void
init_items(isc_mem_t *mctx) {
void *pval = NULL;
uint32_t ival = ~0U;
dns_qp_t *qp = NULL;
uint64_t start;
@ -143,8 +141,8 @@ init_items(isc_mem_t *mctx) {
item[i].key[off] = random_byte();
}
item[i].key[len] = SHIFT_NOBYTE;
} while (dns_qp_getkey(qp, item[i].key, item[i].len, &pval,
&ival) == ISC_R_SUCCESS);
} while (dns_qp_getkey(qp, item[i].key, item[i].len, NULL,
NULL) == ISC_R_SUCCESS);
INSIST(dns_qp_insert(qp, &item[i], i) == ISC_R_SUCCESS);
}
dns_qp_destroy(&qp);
@ -236,8 +234,6 @@ static void
read_zipf(void *varg) {
struct thread_args *args = varg;
isc_nanosecs_t start;
void *pval = NULL;
uint32_t ival;
/* outside time because it is v slow */
uint32_t r[args->tx_per_loop][args->ops_per_tx];
@ -255,7 +251,7 @@ read_zipf(void *varg) {
for (uint32_t op = 0; op < args->ops_per_tx; op++) {
uint32_t i = r[tx][op];
isc_result_t result = dns_qp_getkey(
&qp, item[i].key, item[i].len, &pval, &ival);
&qp, item[i].key, item[i].len, NULL, NULL);
if (result == ISC_R_SUCCESS) {
args->present++;
} else {
@ -274,8 +270,6 @@ static void
read_transactions(void *varg) {
struct thread_args *args = varg;
isc_nanosecs_t start = isc_time_monotonic();
void *pval = NULL;
uint32_t ival;
for (uint32_t tx = 0; tx < args->tx_per_loop; tx++) {
args->transactions++;
@ -284,7 +278,7 @@ read_transactions(void *varg) {
for (uint32_t op = 0; op < args->ops_per_tx; op++) {
uint32_t i = isc_random_uniform(args->max_item);
isc_result_t result = dns_qp_getkey(
&qp, item[i].key, item[i].len, &pval, &ival);
&qp, item[i].key, item[i].len, NULL, NULL);
if (result == ISC_R_SUCCESS) {
args->present++;
} else {