From: Mark Andrews Date: Thu, 24 Apr 2014 03:43:59 +0000 (+1000) Subject: 3818. [bug] Stop lying to the optimizer that 'void *arg' is a X-Git-Tag: v9.10.0~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c41f0af196c7937fc225aa5553a79f74de852113;p=thirdparty%2Fbind9.git 3818. [bug] Stop lying to the optimizer that 'void *arg' is a constant in isc_event_allocate. (cherry picked from commit e916c4f840e6f05c1137a2653b4ef70a1056bf74) --- diff --git a/CHANGES b/CHANGES index a0d032f2988..847fc7d234d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3818. [bug] Stop lying to the optimizer that 'void *arg' is a + constant in isc_event_allocate. + --- 9.10.0rc2 released --- 3817. [func] The "delve" command is now spelled "delv" to avoid diff --git a/lib/isc/event.c b/lib/isc/event.c index 8ab75240dca..2f082779399 100644 --- a/lib/isc/event.c +++ b/lib/isc/event.c @@ -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; diff --git a/lib/isc/include/isc/event.h b/lib/isc/include/isc/event.h index 68fabb2fcc3..40e01fae406 100644 --- a/lib/isc/include/isc/event.h +++ b/lib/isc/include/isc/event.h @@ -90,7 +90,10 @@ ISC_LANG_BEGINDECLS 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 * +isc_event_constallocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type, + isc_taskaction_t action, const void *arg, size_t size); /*%< * Allocate an event structure. *