summaryrefslogtreecommitdiff
path: root/lib/dns/adb.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/adb.c')
-rw-r--r--lib/dns/adb.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/dns/adb.c b/lib/dns/adb.c
index ad60539d..e6af1180 100644
--- a/lib/dns/adb.c
+++ b/lib/dns/adb.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -89,7 +89,7 @@
#define DNS_ADB_INVALIDBUCKET (-1) /*%< invalid bucket address */
-#define DNS_ADB_MINADBSIZE (1024*1024) /*%< 1 Megabyte */
+#define DNS_ADB_MINADBSIZE (1024U*1024U) /*%< 1 Megabyte */
typedef ISC_LIST(dns_adbname_t) dns_adbnamelist_t;
typedef struct dns_adbnamehook dns_adbnamehook_t;
@@ -518,7 +518,9 @@ grow_entries(isc_task_t *task, isc_event_t *ev) {
isc_event_free(&ev);
- isc_task_beginexclusive(task);
+ result = isc_task_beginexclusive(task);
+ if (result != ISC_R_SUCCESS)
+ goto check_exit;
i = 0;
while (nbuckets[i] != 0 && adb->nentries >= nbuckets[i])
@@ -646,6 +648,7 @@ grow_entries(isc_task_t *task, isc_event_t *ev) {
done:
isc_task_endexclusive(task);
+ check_exit:
LOCK(&adb->lock);
if (dec_adb_irefcnt(adb))
check_exit(adb);
@@ -670,7 +673,9 @@ grow_names(isc_task_t *task, isc_event_t *ev) {
isc_event_free(&ev);
- isc_task_beginexclusive(task);
+ result = isc_task_beginexclusive(task);
+ if (result != ISC_R_SUCCESS)
+ goto check_exit;
i = 0;
while (nbuckets[i] != 0 && adb->nnames >= nbuckets[i])
@@ -794,6 +799,7 @@ grow_names(isc_task_t *task, isc_event_t *ev) {
done:
isc_task_endexclusive(task);
+ check_exit:
LOCK(&adb->lock);
if (dec_adb_irefcnt(adb))
check_exit(adb);
@@ -4122,19 +4128,18 @@ water(void *arg, int mark) {
}
void
-dns_adb_setadbsize(dns_adb_t *adb, isc_uint32_t size) {
- isc_uint32_t hiwater;
- isc_uint32_t lowater;
+dns_adb_setadbsize(dns_adb_t *adb, size_t size) {
+ size_t hiwater, lowater;
INSIST(DNS_ADB_VALID(adb));
- if (size != 0 && size < DNS_ADB_MINADBSIZE)
+ if (size != 0U && size < DNS_ADB_MINADBSIZE)
size = DNS_ADB_MINADBSIZE;
hiwater = size - (size >> 3); /* Approximately 7/8ths. */
lowater = size - (size >> 2); /* Approximately 3/4ths. */
- if (size == 0 || hiwater == 0 || lowater == 0)
+ if (size == 0U || hiwater == 0U || lowater == 0U)
isc_mem_setwater(adb->mctx, water, adb, 0, 0);
else
isc_mem_setwater(adb->mctx, water, adb, hiwater, lowater);