summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--semaphore.c7
-rw-r--r--util.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/semaphore.c b/semaphore.c
index 1f43652..33ae9f8 100644
--- a/semaphore.c
+++ b/semaphore.c
@@ -63,10 +63,11 @@ semaphore_init(semaphore_t *sem, int value)
void
semaphore_destroy(semaphore_t *sem)
{
- REQUIRE(sem != NULL);
+ if (sem == NULL)
+ return;
- REQUIRE(isc_mutex_destroy(&sem->mutex) == ISC_R_SUCCESS);
- REQUIRE(isc_condition_destroy(&sem->cond) == ISC_R_SUCCESS);
+ RUNTIME_CHECK(isc_mutex_destroy(&sem->mutex) == ISC_R_SUCCESS);
+ RUNTIME_CHECK(isc_condition_destroy(&sem->cond) == ISC_R_SUCCESS);
}
/*
diff --git a/util.h b/util.h
index 470d3fd..28e42ba 100644
--- a/util.h
+++ b/util.h
@@ -25,4 +25,6 @@
if (result != ISC_R_SUCCESS) goto cleanup; \
} while (0)
+#define ZERO_PTR(ptr, type) memset((ptr), 0, sizeof(type))
+
#endif /* !_LD_UTIL_H_ */