2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Check return values or cast them to (void), as required by the coding

standards; add exceptions to the coding standards for cases where this is
not desirable
This commit is contained in:
Andreas Gustafsson
2001-11-30 01:59:49 +00:00
parent 9ac8796f16
commit 1f1d36a87b
61 changed files with 420 additions and 409 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: peer.c,v 1.16 2001/11/12 19:05:26 gson Exp $ */
/* $Id: peer.c,v 1.17 2001/11/30 01:59:14 gson Exp $ */
#include <config.h>
@@ -38,11 +38,11 @@
#define REQUEST_IXFR_BIT 4
#define SUPPORT_EDNS_BIT 5
static isc_result_t
dns_peerlist_delete(dns_peerlist_t **list);
static void
peerlist_delete(dns_peerlist_t **list);
static isc_result_t
dns_peer_delete(dns_peer_t **peer);
static void
peer_delete(dns_peer_t **peer);
isc_result_t
dns_peerlist_new(isc_mem_t *mem, dns_peerlist_t **list) {
@@ -51,9 +51,8 @@ dns_peerlist_new(isc_mem_t *mem, dns_peerlist_t **list) {
REQUIRE(list != NULL);
l = isc_mem_get(mem, sizeof(*l));
if (l == NULL) {
if (l == NULL)
return (ISC_R_NOMEMORY);
}
ISC_LIST_INIT(l->elements);
l->mem = mem;
@@ -94,16 +93,14 @@ dns_peerlist_detach(dns_peerlist_t **list) {
plist->refs--;
if (plist->refs == 0) {
dns_peerlist_delete(&plist);
}
if (plist->refs == 0)
peerlist_delete(&plist);
}
static isc_result_t
dns_peerlist_delete(dns_peerlist_t **list) {
static void
peerlist_delete(dns_peerlist_t **list) {
dns_peerlist_t *l;
dns_peer_t *server, *stmp;
isc_result_t r;
REQUIRE(list != NULL);
REQUIRE(DNS_PEERLIST_VALID(*list));
@@ -116,11 +113,7 @@ dns_peerlist_delete(dns_peerlist_t **list) {
while (server != NULL) {
stmp = ISC_LIST_NEXT(server, next);
ISC_LIST_UNLINK(l->elements, server, next);
r = dns_peer_detach(&server);
if (r != ISC_R_SUCCESS) {
return (r);
}
dns_peer_detach(&server);
server = stmp;
}
@@ -128,8 +121,6 @@ dns_peerlist_delete(dns_peerlist_t **list) {
isc_mem_put(l->mem, l, sizeof(*l));
*list = NULL;
return (ISC_R_SUCCESS);
}
void
@@ -153,9 +144,8 @@ dns_peerlist_peerbyaddr(dns_peerlist_t *servers,
server = ISC_LIST_HEAD(servers->elements);
while (server != NULL) {
if (isc_netaddr_equal(addr, &server->address)) {
if (isc_netaddr_equal(addr, &server->address))
break;
}
server = ISC_LIST_NEXT(server, next);
}
@@ -190,9 +180,8 @@ dns_peer_new(isc_mem_t *mem, isc_netaddr_t *addr, dns_peer_t **peerptr) {
REQUIRE(peerptr != NULL);
peer = isc_mem_get(mem, sizeof(*peer));
if (peer == NULL) {
if (peer == NULL)
return (ISC_R_NOMEMORY);
}
peer->magic = DNS_PEER_MAGIC;
peer->address = *addr;
@@ -214,7 +203,7 @@ dns_peer_new(isc_mem_t *mem, isc_netaddr_t *addr, dns_peer_t **peerptr) {
return (ISC_R_SUCCESS);
}
isc_result_t
void
dns_peer_attach(dns_peer_t *source, dns_peer_t **target) {
REQUIRE(DNS_PEER_VALID(source));
REQUIRE(target != NULL);
@@ -225,11 +214,9 @@ dns_peer_attach(dns_peer_t *source, dns_peer_t **target) {
ENSURE(source->refs != 0xffffffffU);
*target = source;
return (ISC_R_SUCCESS);
}
isc_result_t
void
dns_peer_detach(dns_peer_t **peer) {
dns_peer_t *p;
@@ -244,15 +231,12 @@ dns_peer_detach(dns_peer_t **peer) {
*peer = NULL;
p->refs--;
if (p->refs == 0) {
dns_peer_delete(&p);
}
return (ISC_R_SUCCESS);
if (p->refs == 0)
peer_delete(&p);
}
static isc_result_t
dns_peer_delete(dns_peer_t **peer) {
static void
peer_delete(dns_peer_t **peer) {
dns_peer_t *p;
isc_mem_t *mem;
@@ -275,8 +259,6 @@ dns_peer_delete(dns_peer_t **peer) {
isc_mem_put(mem, p, sizeof(*p));
*peer = NULL;
return (ISC_R_SUCCESS);
}
isc_result_t