mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
Describe and enforce the contract for isc_event_allocate().
Silent failure for bad args is not the BIND 9 way.
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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
|
* 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;
|
isc_event_t *event;
|
||||||
void *deconst_arg;
|
void *deconst_arg;
|
||||||
|
|
||||||
if (size < sizeof (struct isc_event))
|
REQUIRE(size >= sizeof (struct isc_event));
|
||||||
return (NULL);
|
REQUIRE(action != NULL);
|
||||||
if (action == NULL)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
event = isc_mem_get(mctx, size);
|
event = isc_mem_get(mctx, size);
|
||||||
if (event == NULL)
|
if (event == NULL)
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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
|
#ifndef ISC_EVENT_H
|
||||||
#define ISC_EVENT_H 1
|
#define ISC_EVENT_H 1
|
||||||
@@ -85,8 +85,25 @@ struct isc_event {
|
|||||||
ISC_LANG_BEGINDECLS
|
ISC_LANG_BEGINDECLS
|
||||||
|
|
||||||
isc_event_t *
|
isc_event_t *
|
||||||
isc_event_allocate(isc_mem_t *, void *, isc_eventtype_t, isc_taskaction_t,
|
isc_event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type,
|
||||||
const void *arg, size_t);
|
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
|
void
|
||||||
isc_event_free(isc_event_t **);
|
isc_event_free(isc_event_t **);
|
||||||
|
Reference in New Issue
Block a user