* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.h,v 1.106.2.1 2001/11/13 18:57:14 gson Exp $ */
+/* $Id: zone.h,v 1.106.2.2 2002/01/23 02:05:42 gson Exp $ */
#ifndef DNS_ZONE_H
#define DNS_ZONE_H 1
isc_uint32_t count);
/*
* Set the list of additional servers to be notified when
- * a zone changes. To clear the list use 'notify = NULL'
- * and 'count = 0'.
+ * a zone changes. To clear the list use 'count = 0'.
*
* Require:
* 'zone' to be a valid zone.
- * 'notify' to be non NULL.
- * 'count' the number of notify.
- *
- * If 'notify' is NULL then 'count' must be zero.
+ * 'notify' to be non-NULL if count != 0.
+ * 'count' to be the number of notifyees
*
* Returns:
* ISC_R_SUCCESS
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.c,v 1.333.2.5 2001/11/13 18:57:11 gson Exp $ */
+/* $Id: zone.c,v 1.333.2.6 2002/01/23 02:05:40 gson Exp $ */
#include <config.h>
isc_sockaddr_t *new;
REQUIRE(DNS_ZONE_VALID(zone));
- REQUIRE((notify == NULL && count == 0) ||
- (notify != NULL && count != 0));
+ REQUIRE(count == 0 || notify != NULL);
LOCK_ZONE(zone);
if (zone->notify != NULL) {
zone->notify = NULL;
zone->notifycnt = 0;
}
- if (notify == NULL)
- goto unlock;
-
- new = isc_mem_get(zone->mctx, count * sizeof *new);
- if (new == NULL) {
- UNLOCK_ZONE(zone);
- return (ISC_R_NOMEMORY);
+ if (count != 0) {
+ new = isc_mem_get(zone->mctx, count * sizeof *new);
+ if (new == NULL) {
+ UNLOCK_ZONE(zone);
+ return (ISC_R_NOMEMORY);
+ }
+ memcpy(new, notify, count * sizeof *new);
+ zone->notify = new;
+ zone->notifycnt = count;
}
- memcpy(new, notify, count * sizeof *new);
- zone->notify = new;
- zone->notifycnt = count;
-
- unlock:
UNLOCK_ZONE(zone);
return (ISC_R_SUCCESS);
}