trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mas...@apache.org
Subject [trafficserver] 02/02: Fix a build error on Fedora 26
Date Thu, 10 Aug 2017 03:20:49 GMT
This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit b51be170deb0cec505233b912e9b80c72d33913b
Author: Masakazu Kitajo <maskit@apache.org>
AuthorDate: Thu Aug 10 12:15:21 2017 +0900

    Fix a build error on Fedora 26
    
    swap() in Vec.h was actually a global function, and it seems like the function
    confuses gcc 7.1.1 if we use unique_ptr in some situation.
---
 lib/ts/Vec.h | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/lib/ts/Vec.h b/lib/ts/Vec.h
index 00da28f..ff7d815 100644
--- a/lib/ts/Vec.h
+++ b/lib/ts/Vec.h
@@ -149,7 +149,7 @@ public:
   int read(int fd);
   void qsort(bool (*lt)(C, C));
   void qsort(bool (*lt)(const C &, const C &));
-  void swap(C *p1, C *p2);
+  static void swap(C *p1, C *p2);
 
 private:
   void move_internal(Vec<C, A, S> &v);
@@ -950,9 +950,9 @@ Vec<C, A, S>::read(int fd)
   return t;
 }
 
-template <class C>
+template <class C, class A, int S>
 inline void
-swap(C *p1, C *p2)
+Vec<C, A, S>::swap(C *p1, C *p2)
 {
   C t = *p1;
   *p1 = *p2;
@@ -979,15 +979,15 @@ qsort_Vec(C *left, C *right, bool (*lt)(C, C))
 
     // find the median
     if (lt(*center, *left)) { // order left and center
-      swap(center, left);
+      Vec<C>::swap(center, left);
     }
     if (lt(*(right - 1), *left)) { // order left and right
-      swap(right - 1, left);
+      Vec<C>::swap(right - 1, left);
     }
     if (lt(*(right - 1), *center)) { // order right and center
-      swap((right - 1), center);
+      Vec<C>::swap((right - 1), center);
     }
-    swap(center, right - 2); // stash the median one from the right for now
+    Vec<C>::swap(center, right - 2); // stash the median one from the right for now
     median = *(right - 2);   // the median of left, center and right values
 
     // now partition, pivoting on the median value
@@ -1011,12 +1011,12 @@ qsort_Vec(C *left, C *right, bool (*lt)(C, C))
       if (lt(*l, median)) {
         l++;
       } else {
-        swap(l, r - 1);
+        Vec<C>::swap(l, r - 1);
         r--;
       }
     }
 
-    swap(l, right - 2); // restore median to its rightful place
+    Vec<C>::swap(l, right - 2); // restore median to its rightful place
 
     // recurse for the littles (left segment)
     qsort_Vec<C>(left, l, lt);
@@ -1045,15 +1045,15 @@ qsort_VecRef(C *left, C *right, bool (*lt)(const C &, const C
&), unsigned int *
 
     // find the median
     if (lt(*center, *left)) { // order left and center
-      swap(center, left);
+      Vec<C>::swap(center, left);
     }
     if (lt(*(right - 1), *left)) { // order left and right
-      swap(right - 1, left);
+      Vec<C>::swap(right - 1, left);
     }
     if (lt(*(right - 1), *center)) { // order right and center
-      swap((right - 1), center);
+      Vec<C>::swap((right - 1), center);
     }
-    swap(center, right - 2); // stash the median one from the right for now
+    Vec<C>::swap(center, right - 2); // stash the median one from the right for now
     median = *(right - 2);   // the median of left, center and right values
 
     // now partition, pivoting on the median value
@@ -1077,12 +1077,12 @@ qsort_VecRef(C *left, C *right, bool (*lt)(const C &, const C
&), unsigned int *
       if (lt(*l, median)) {
         l++;
       } else {
-        swap(l, r - 1);
+        Vec<C>::swap(l, r - 1);
         r--;
       }
     }
 
-    swap(l, right - 2); // restore median to its rightful place
+    Vec<C>::swap(l, right - 2); // restore median to its rightful place
 
     // recurse for the littles (left segment)
     qsort_VecRef<C>(left, l, lt, p_ctr);

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Mime
View raw message