diff --git a/lib/isc/event.c b/lib/isc/event.c index b4420d2904..c1aedbaf67 100644 --- a/lib/isc/event.c +++ b/lib/isc/event.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: event.c,v 1.13 2000/08/01 01:29:21 tale Exp $ */ +/* $Id: event.c,v 1.14 2000/09/27 22:53:31 marka Exp $ */ /* * Principal Author: Bob Halley @@ -45,10 +45,8 @@ isc_event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type, isc_event_t *event; void *deconst_arg; - if (size < sizeof (struct isc_event)) - return (NULL); - if (action == NULL) - return (NULL); + REQUIRE(size >= sizeof (struct isc_event)); + REQUIRE(action != NULL); event = isc_mem_get(mctx, size); if (event == NULL) diff --git a/lib/isc/include/isc/event.h b/lib/isc/include/isc/event.h index 274f6de723..e6cf8a34f8 100644 --- a/lib/isc/include/isc/event.h +++ b/lib/isc/include/isc/event.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: event.h,v 1.22 2000/08/01 01:30:08 tale Exp $ */ +/* $Id: event.h,v 1.23 2000/09/27 22:53:33 marka Exp $ */ #ifndef ISC_EVENT_H #define ISC_EVENT_H 1 @@ -85,8 +85,25 @@ struct isc_event { ISC_LANG_BEGINDECLS isc_event_t * -isc_event_allocate(isc_mem_t *, void *, isc_eventtype_t, isc_taskaction_t, - const void *arg, size_t); +isc_event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type, + isc_taskaction_t action, const void *arg, size_t size); +/* + * Allocate and initalise in a structure with initial elements + * defined by: + * + * struct { + * ISC_EVENT_COMMON(struct isc_event); + * ... + * }; + * + * Requires: + * 'size' >= sizeof(struct isc_event) + * 'action' to be non NULL + * + * Returns: + * a pointer to a initalised structure of the requested size. + * NULL if unable to allocate memory. + */ void isc_event_free(isc_event_t **);