trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [trafficserver] branch master updated: gcc9 - Fix I_Store.h
Date Tue, 07 May 2019 18:51:58 GMT
This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 55e1467  gcc9 - Fix I_Store.h
55e1467 is described below

commit 55e1467f4ecdbbeddfef4ca9cc7abb6846b46c2e
Author: Alan M. Carroll <amc@apache.org>
AuthorDate: Mon May 6 11:37:32 2019 -0500

    gcc9 - Fix I_Store.h
---
 iocore/cache/I_Store.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/iocore/cache/I_Store.h b/iocore/cache/I_Store.h
index 901ae9f..73a2b6d 100644
--- a/iocore/cache/I_Store.h
+++ b/iocore/cache/I_Store.h
@@ -160,11 +160,17 @@ public:
   Span() { disk_id[0] = disk_id[1] = 0; }
 
   /// Copy constructor.
-  /// @internal Prior to this implementation handling the char* pointers was done manual
-  /// at every call site. We also need this because we have ats_scoped_str members.
+  /// @internal Prior to this implementation handling the char* pointers was done manually
+  /// at every call site. We also need this because we have @c ats_scoped_str members and
need
+  /// to make copies.
   Span(Span const &that)
   {
-    memcpy(this, &that, reinterpret_cast<intptr_t>(&(static_cast<Span *>(nullptr)->pathname)));
+    /* I looked at simplifying this by changing the @c ats_scoped_str instances to @c std::string
+     * but that actually makes it worse. The copy constructor @b must be overriden to get
the
+     * internal link (@a link.next) correct. Given that, changing to @c std::string means
doing
+     * explicit assignment for every member, which has its own problems.
+     */
+    memcpy(static_cast<void *>(this), &that, reinterpret_cast<intptr_t>(&(static_cast<Span
*>(nullptr)->pathname)));
     if (that.pathname) {
       pathname = ats_strdup(that.pathname);
     }


Mime
View raw message