This is an automated email from the ASF dual-hosted git repository.

gmurthy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/main by this push:
     new ae136bb  DISPATCH-2030: Use memcpy to copy the tag into the delivery. 
This closes #1116.
ae136bb is described below

commit ae136bbd226f1b0b2470c6af5d29895faa618226
Author: Ganesh Murthy <gmur...@apache.org>
AuthorDate: Tue Apr 13 12:49:22 2021 -0400

    DISPATCH-2030: Use memcpy to copy the tag into the delivery. This closes 
#1116.
---
 src/router_core/core_link_endpoint.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/router_core/core_link_endpoint.c 
b/src/router_core/core_link_endpoint.c
index 5ac7276..f6e2b9c 100644
--- a/src/router_core/core_link_endpoint.c
+++ b/src/router_core/core_link_endpoint.c
@@ -119,13 +119,12 @@ void qdrc_endpoint_flow_CT(qdr_core_t *core, 
qdrc_endpoint_t *ep, int credit, bo
 
 void qdrc_endpoint_send_CT(qdr_core_t *core, qdrc_endpoint_t *ep, 
qdr_delivery_t *dlv, bool presettled)
 {
-    uint64_t *tag = (uint64_t*) dlv->tag;
-
     set_safe_ptr_qdr_link_t(ep->link, &dlv->link_sp);
     dlv->settled       = presettled;
     dlv->presettled    = presettled;
-    *tag               = core->next_tag++;
     dlv->tag_length    = 8;
+    uint64_t next_tag  = core->next_tag++;
+    memcpy(dlv->tag, &next_tag, dlv->tag_length);
     dlv->ingress_index = -1;
 
     qdr_forward_deliver_CT(core, ep->link, dlv);
@@ -135,7 +134,6 @@ void qdrc_endpoint_send_CT(qdr_core_t *core, 
qdrc_endpoint_t *ep, qdr_delivery_t
 qdr_delivery_t *qdrc_endpoint_delivery_CT(qdr_core_t *core, qdrc_endpoint_t 
*endpoint, qd_message_t *message)
 {
     qdr_delivery_t *dlv = new_qdr_delivery_t();
-    uint64_t       *tag = (uint64_t*) dlv->tag;
 
     if (endpoint->link->conn)
         endpoint->link->conn->last_delivery_time = core->uptime_ticks;
@@ -143,9 +141,10 @@ qdr_delivery_t *qdrc_endpoint_delivery_CT(qdr_core_t 
*core, qdrc_endpoint_t *end
     ZERO(dlv);
     set_safe_ptr_qdr_link_t(endpoint->link, &dlv->link_sp);
     dlv->msg            = message;
-    *tag                = core->next_tag++;
-    dlv->tag_length = 8;
-    dlv->ingress_index = -1;
+    dlv->tag_length     = 8;
+    uint64_t next_tag = core->next_tag++;
+    memcpy(dlv->tag, &next_tag, dlv->tag_length);
+    dlv->ingress_index  = -1;
     dlv->delivery_id = next_delivery_id();
     dlv->link_id     = endpoint->link->identity;
     dlv->conn_id     = endpoint->link->conn_id;

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to