summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Jung <jung@cvs.openbsd.org>2020-02-22 19:50:06 +0000
committerJoerg Jung <jung@cvs.openbsd.org>2020-02-22 19:50:06 +0000
commitfee7009bc471bed45e8d96c079042b09d99a677f (patch)
tree55d257caa043a5fd1862f6f6d74f20a548c0fff5
parent945f57cb2410b6498f0311204c74b092b91fd025 (diff)
remove some unused args and unused assignments, as result
msgblock_free() becomes just free() also add UNUSED() for some dns_message *msg args for later revisit and cleanup ok millert florian
-rw-r--r--usr.bin/dig/lib/dns/dst_parse.c8
-rw-r--r--usr.bin/dig/lib/dns/include/dns/message.h1
-rw-r--r--usr.bin/dig/lib/dns/include/dns/rdataset.h5
-rw-r--r--usr.bin/dig/lib/dns/message.c52
-rw-r--r--usr.bin/dig/lib/dns/rdataset.c14
-rw-r--r--usr.bin/dig/lib/isc/timer.c14
6 files changed, 30 insertions, 64 deletions
diff --git a/usr.bin/dig/lib/dns/dst_parse.c b/usr.bin/dig/lib/dns/dst_parse.c
index 07f842f8c40..5cddc67d893 100644
--- a/usr.bin/dig/lib/dns/dst_parse.c
+++ b/usr.bin/dig/lib/dns/dst_parse.c
@@ -33,7 +33,7 @@
/*%
* Principal Author: Brian Wellington
- * $Id: dst_parse.c,v 1.4 2020/02/13 12:03:51 jsg Exp $
+ * $Id: dst_parse.c,v 1.5 2020/02/22 19:50:05 jung Exp $
*/
@@ -147,10 +147,8 @@ check_hmac_sha(const dst_private_t *priv, unsigned int ntags,
}
static int
-check_data(const dst_private_t *priv, const unsigned int alg,
- isc_boolean_t old, isc_boolean_t external)
+check_data(const dst_private_t *priv, const unsigned int alg)
{
- UNUSED(old);
/* XXXVIX this switch statement is too sparse to gen a jump table. */
switch (alg) {
case DST_ALG_HMACSHA1:
@@ -355,7 +353,7 @@ dst__privstruct_parse(dst_key_t *key, unsigned int alg, isc_lex_t *lex,
goto fail;
}
- check = check_data(priv, alg, ISC_TRUE, external);
+ check = check_data(priv, alg);
if (check < 0) {
ret = DST_R_INVALIDPRIVATEKEY;
goto fail;
diff --git a/usr.bin/dig/lib/dns/include/dns/message.h b/usr.bin/dig/lib/dns/include/dns/message.h
index 745d4cca278..834c97a3b7d 100644
--- a/usr.bin/dig/lib/dns/include/dns/message.h
+++ b/usr.bin/dig/lib/dns/include/dns/message.h
@@ -169,7 +169,6 @@ typedef int dns_messagetextflag_t;
*/
#define DNS_MESSAGERENDER_ORDERED 0x0001 /*%< don't change order */
#define DNS_MESSAGERENDER_PARTIAL 0x0002 /*%< allow a partial rdataset */
-#define DNS_MESSAGERENDER_OMITDNSSEC 0x0004 /*%< omit DNSSEC records */
#define DNS_MESSAGERENDER_PREFER_A 0x0008 /*%< prefer A records in
additional section. */
#define DNS_MESSAGERENDER_PREFER_AAAA 0x0010 /*%< prefer AAAA records in
diff --git a/usr.bin/dig/lib/dns/include/dns/rdataset.h b/usr.bin/dig/lib/dns/include/dns/rdataset.h
index 2792e33361c..74f65209970 100644
--- a/usr.bin/dig/lib/dns/include/dns/rdataset.h
+++ b/usr.bin/dig/lib/dns/include/dns/rdataset.h
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdataset.h,v 1.5 2020/02/18 18:11:27 florian Exp $ */
+/* $Id: rdataset.h,v 1.6 2020/02/22 19:50:05 jung Exp $ */
#ifndef DNS_RDATASET_H
#define DNS_RDATASET_H 1
@@ -353,7 +353,6 @@ dns_rdataset_towire(dns_rdataset_t *rdataset,
dns_name_t *owner_name,
dns_compress_t *cctx,
isc_buffer_t *target,
- unsigned int options,
unsigned int *countp);
/*%<
* Convert 'rdataset' to wire format, compressing names as specified
@@ -394,7 +393,6 @@ dns_rdataset_towiresorted(dns_rdataset_t *rdataset,
isc_buffer_t *target,
dns_rdatasetorderfunc_t order,
const void *order_arg,
- unsigned int options,
unsigned int *countp);
/*%<
* Like dns_rdataset_towire(), but sorting the rdatasets according to
@@ -413,7 +411,6 @@ dns_rdataset_towirepartial(dns_rdataset_t *rdataset,
isc_buffer_t *target,
dns_rdatasetorderfunc_t order,
const void *order_arg,
- unsigned int options,
unsigned int *countp,
void **state);
/*%<
diff --git a/usr.bin/dig/lib/dns/message.c b/usr.bin/dig/lib/dns/message.c
index 9481ba30471..fa7744678cd 100644
--- a/usr.bin/dig/lib/dns/message.c
+++ b/usr.bin/dig/lib/dns/message.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: message.c,v 1.7 2020/02/18 18:11:27 florian Exp $ */
+/* $Id: message.c,v 1.8 2020/02/22 19:50:05 jung Exp $ */
/*! \file */
@@ -112,9 +112,6 @@ msgblock_internalget(dns_msgblock_t *, unsigned int);
static inline void
msgblock_reset(dns_msgblock_t *);
-static inline void
-msgblock_free(dns_msgblock_t *, unsigned int);
-
/*
* Allocate a new dns_msgblock_t, and return a pointer to it. If no memory
* is free, return NULL.
@@ -166,19 +163,6 @@ msgblock_reset(dns_msgblock_t *block) {
}
/*
- * Release memory associated with a message block.
- */
-static inline void
-msgblock_free(dns_msgblock_t *block, unsigned int sizeof_type)
-{
- unsigned int length;
-
- length = sizeof(dns_msgblock_t) + (sizeof_type * block->count);
-
- free(block);
-}
-
-/*
* Allocate a new dynamic buffer, and attach it to this message as the
* "current" buffer. (which is always the last on the list, for our
* uses)
@@ -513,7 +497,7 @@ msgreset(dns_message_t *msg, isc_boolean_t everything) {
while (msgblock != NULL) {
next_msgblock = ISC_LIST_NEXT(msgblock, link);
ISC_LIST_UNLINK(msg->rdatas, msgblock, link);
- msgblock_free(msgblock, sizeof(dns_rdata_t));
+ free(msgblock);
msgblock = next_msgblock;
}
@@ -529,7 +513,7 @@ msgreset(dns_message_t *msg, isc_boolean_t everything) {
while (msgblock != NULL) {
next_msgblock = ISC_LIST_NEXT(msgblock, link);
ISC_LIST_UNLINK(msg->rdatalists, msgblock, link);
- msgblock_free(msgblock, sizeof(dns_rdatalist_t));
+ free(msgblock);
msgblock = next_msgblock;
}
@@ -541,7 +525,7 @@ msgreset(dns_message_t *msg, isc_boolean_t everything) {
while (msgblock != NULL) {
next_msgblock = ISC_LIST_NEXT(msgblock, link);
ISC_LIST_UNLINK(msg->offsets, msgblock, link);
- msgblock_free(msgblock, sizeof(dns_offsets_t));
+ free(msgblock);
msgblock = next_msgblock;
}
@@ -1754,7 +1738,7 @@ wrong_priority(dns_rdataset_t *rds, int pass, dns_rdatatype_t preferred_glue) {
static isc_result_t
renderset(dns_rdataset_t *rdataset, dns_name_t *owner_name,
dns_compress_t *cctx, isc_buffer_t *target,
- unsigned int reserved, unsigned int options, unsigned int *countp)
+ unsigned int reserved, unsigned int *countp)
{
isc_result_t result;
@@ -1766,7 +1750,7 @@ renderset(dns_rdataset_t *rdataset, dns_name_t *owner_name,
target->length -= reserved;
result = dns_rdataset_towire(rdataset, owner_name,
- cctx, target, options, countp);
+ cctx, target, countp);
target->length += reserved;
return (result);
@@ -1793,7 +1777,6 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
isc_buffer_t st; /* for rollbacks */
int pass;
isc_boolean_t partial = ISC_FALSE;
- unsigned int rd_options;
dns_rdatatype_t preferred_glue = 0;
REQUIRE(msg->buffer != NULL);
@@ -1814,11 +1797,6 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
} else
pass = 1;
- if ((options & DNS_MESSAGERENDER_OMITDNSSEC) == 0)
- rd_options = 0;
- else
- rd_options = DNS_RDATASETTOWIRE_OMITDNSSEC;
-
/*
* Shrink the space in the buffer by the reserved amount.
*/
@@ -1849,7 +1827,6 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
msg->buffer,
msg->order,
order_arg,
- rd_options,
&count,
NULL);
else
@@ -1859,7 +1836,6 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
msg->buffer,
msg->order,
order_arg,
- rd_options,
&count);
total += count;
if (partial && result == ISC_R_NOSPACE) {
@@ -1920,7 +1896,6 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
msg->buffer,
msg->order,
msg->order_arg,
- rd_options,
&count,
NULL);
else
@@ -1931,7 +1906,6 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
msg->buffer,
msg->order,
msg->order_arg,
- rd_options,
&count);
total += count;
@@ -2083,7 +2057,7 @@ dns_message_renderend(dns_message_t *msg) {
*/
count = 0;
result = renderset(msg->opt, dns_rootname, msg->cctx,
- msg->buffer, msg->reserved, 0, &count);
+ msg->buffer, msg->reserved, &count);
msg->counts[DNS_SECTION_ADDITIONAL] += count;
if (result != ISC_R_SUCCESS)
return (result);
@@ -2100,7 +2074,7 @@ dns_message_renderend(dns_message_t *msg) {
return (result);
count = 0;
result = renderset(msg->tsig, msg->tsigname, msg->cctx,
- msg->buffer, msg->reserved, 0, &count);
+ msg->buffer, msg->reserved, &count);
msg->counts[DNS_SECTION_ADDITIONAL] += count;
if (result != ISC_R_SUCCESS)
return (result);
@@ -2257,6 +2231,8 @@ isc_result_t
dns_message_gettempname(dns_message_t *msg, dns_name_t **item) {
REQUIRE(item != NULL && *item == NULL);
+ UNUSED(msg);
+
*item = malloc(sizeof(dns_name_t));
if (*item == NULL)
return (ISC_R_NOMEMORY);
@@ -2280,6 +2256,8 @@ isc_result_t
dns_message_gettemprdataset(dns_message_t *msg, dns_rdataset_t **item) {
REQUIRE(item != NULL && *item == NULL);
+ UNUSED(msg);
+
*item = malloc(sizeof(dns_rdataset_t));
if (*item == NULL)
return (ISC_R_NOMEMORY);
@@ -2304,6 +2282,8 @@ void
dns_message_puttempname(dns_message_t *msg, dns_name_t **item) {
REQUIRE(item != NULL && *item != NULL);
+ UNUSED(msg);
+
if (dns_name_dynamic(*item))
dns_name_free(*item);
free(*item);
@@ -2321,8 +2301,10 @@ dns_message_puttemprdata(dns_message_t *msg, dns_rdata_t **item) {
void
dns_message_puttemprdataset(dns_message_t *msg, dns_rdataset_t **item) {
REQUIRE(item != NULL && *item != NULL);
-
REQUIRE(!dns_rdataset_isassociated(*item));
+
+ UNUSED(msg);
+
free(*item);
*item = NULL;
}
diff --git a/usr.bin/dig/lib/dns/rdataset.c b/usr.bin/dig/lib/dns/rdataset.c
index 13e3d487a72..fdb1fc24d15 100644
--- a/usr.bin/dig/lib/dns/rdataset.c
+++ b/usr.bin/dig/lib/dns/rdataset.c
@@ -240,8 +240,7 @@ static isc_result_t
towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
dns_compress_t *cctx, isc_buffer_t *target,
dns_rdatasetorderfunc_t order, const void *order_arg,
- isc_boolean_t partial, unsigned int options,
- unsigned int *countp, void **state)
+ isc_boolean_t partial, unsigned int *countp, void **state)
{
dns_rdata_t rdata = DNS_RDATA_INIT;
isc_region_t r;
@@ -474,12 +473,10 @@ dns_rdataset_towiresorted(dns_rdataset_t *rdataset,
isc_buffer_t *target,
dns_rdatasetorderfunc_t order,
const void *order_arg,
- unsigned int options,
unsigned int *countp)
{
return (towiresorted(rdataset, owner_name, cctx, target,
- order, order_arg, ISC_FALSE, options,
- countp, NULL));
+ order, order_arg, ISC_FALSE, countp, NULL));
}
isc_result_t
@@ -489,14 +486,12 @@ dns_rdataset_towirepartial(dns_rdataset_t *rdataset,
isc_buffer_t *target,
dns_rdatasetorderfunc_t order,
const void *order_arg,
- unsigned int options,
unsigned int *countp,
void **state)
{
REQUIRE(state == NULL); /* XXX remove when implemented */
return (towiresorted(rdataset, owner_name, cctx, target,
- order, order_arg, ISC_TRUE, options,
- countp, state));
+ order, order_arg, ISC_TRUE, countp, state));
}
isc_result_t
@@ -504,9 +499,8 @@ dns_rdataset_towire(dns_rdataset_t *rdataset,
dns_name_t *owner_name,
dns_compress_t *cctx,
isc_buffer_t *target,
- unsigned int options,
unsigned int *countp)
{
return (towiresorted(rdataset, owner_name, cctx, target,
- NULL, NULL, ISC_FALSE, options, countp, NULL));
+ NULL, NULL, ISC_FALSE, countp, NULL));
}
diff --git a/usr.bin/dig/lib/isc/timer.c b/usr.bin/dig/lib/isc/timer.c
index 6dbbf1d2cb1..265f32f14c2 100644
--- a/usr.bin/dig/lib/isc/timer.c
+++ b/usr.bin/dig/lib/isc/timer.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: timer.c,v 1.20 2020/02/21 07:44:50 florian Exp $ */
+/* $Id: timer.c,v 1.21 2020/02/22 19:50:05 jung Exp $ */
/*! \file */
@@ -70,7 +70,7 @@ struct isc_timermgr {
static isc_timermgr_t *timermgr = NULL;
static inline isc_result_t
-schedule(isc_timer_t *timer, struct timespec *now, isc_boolean_t signal_ok) {
+schedule(isc_timer_t *timer) {
isc_result_t result;
isc_timermgr_t *manager;
struct timespec due;
@@ -79,8 +79,6 @@ schedule(isc_timer_t *timer, struct timespec *now, isc_boolean_t signal_ok) {
* Note: the caller must ensure locking.
*/
- UNUSED(signal_ok);
-
manager = timer->manager;
/*
@@ -218,7 +216,7 @@ isc_timer_create(isc_timermgr_t *manager0, const struct timespec *interval,
timer->index = 0;
ISC_LINK_INIT(timer, link);
- result = schedule(timer, &now, ISC_TRUE);
+ result = schedule(timer);
if (result == ISC_R_SUCCESS)
APPEND(manager->timers, timer, link);
@@ -238,7 +236,6 @@ isc_timer_reset(isc_timer_t *timer, const struct timespec *interval,
isc_boolean_t purge)
{
struct timespec now;
- isc_timermgr_t *manager;
isc_result_t result;
/*
@@ -247,7 +244,6 @@ isc_timer_reset(isc_timer_t *timer, const struct timespec *interval,
* are purged from its task's event queue.
*/
- manager = timer->manager;
REQUIRE(interval != NULL);
REQUIRE(timespecisset(interval));
@@ -269,7 +265,7 @@ isc_timer_reset(isc_timer_t *timer, const struct timespec *interval,
timespecclear(&timer->idle);
}
- result = schedule(timer, &now, ISC_TRUE);
+ result = schedule(timer);
return (result);
}
@@ -371,7 +367,7 @@ dispatch(isc_timermgr_t *manager, struct timespec *now) {
manager->nscheduled--;
if (need_schedule) {
- result = schedule(timer, now, ISC_FALSE);
+ result = schedule(timer);
if (result != ISC_R_SUCCESS)
UNEXPECTED_ERROR(__FILE__, __LINE__,
"%s: %u",