]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3818. [bug] Stop lying to the optimizer that 'void *arg' is a
authorMark Andrews <marka@isc.org>
Thu, 24 Apr 2014 03:43:59 +0000 (13:43 +1000)
committerMark Andrews <marka@isc.org>
Thu, 24 Apr 2014 03:45:28 +0000 (13:45 +1000)
                        constant in isc_event_allocate.

(cherry picked from commit e916c4f840e6f05c1137a2653b4ef70a1056bf74)

CHANGES
lib/isc/event.c
lib/isc/include/isc/event.h

diff --git a/CHANGES b/CHANGES
index a0d032f2988e0778ea0dae59cf9db958fb09f35e..847fc7d234d931283ec5051ea0f742e770940f35 100644 (file)
--- 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
index 8ab75240dca9a2bfce73b5aabaebfa777a8cb9e0..2f0827793991efa86c06c694b656f2e061ffb46a 100644 (file)
@@ -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;
index 68fabb2fcc3cd2d9bc9f6d611beb70f71e1f4163..40e01fae406682382562f4c054195012e3abcd85 100644 (file)
@@ -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. 
  *