summaryrefslogtreecommitdiff
path: root/lib/isc/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/isc/event.c')
-rw-r--r--lib/isc/event.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/isc/event.c b/lib/isc/event.c
index 8ab75240dca9a..895e3d82fe8d7 100644
--- a/lib/isc/event.c
+++ b/lib/isc/event.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -41,7 +41,26 @@ destroy(isc_event_t *event) {
isc_event_t *
isc_event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type,
- isc_taskaction_t action, const void *arg, size_t size)
+ isc_taskaction_t action, void *arg, size_t size)
+{
+ isc_event_t *event;
+
+ REQUIRE(size >= sizeof(struct isc_event));
+ REQUIRE(action != NULL);
+
+ event = isc_mem_get(mctx, size);
+ if (event == NULL)
+ return (NULL);
+
+ ISC_EVENT_INIT(event, size, 0, NULL, type, action, arg,
+ sender, destroy, mctx);
+
+ return (event);
+}
+
+isc_event_t *
+isc_event_constallocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type,
+ isc_taskaction_t action, const void *arg, size_t size)
{
isc_event_t *event;
void *deconst_arg;