Experiment with simple structured bindings use
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jun 2019 02:00:47 +0000 (02:00 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jun 2019 02:00:47 +0000 (02:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198905

Reviewed by Darin Adler.

* wtf/URLHelpers.cpp:
(WTF::URLHelpers::mapHostNames):
Simplify code using c++ structured bindings (https://en.cppreference.com/w/cpp/language/structured_binding)
to see if all the platforms will work with it.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246826 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WTF/ChangeLog
Source/WTF/wtf/URLHelpers.cpp

index 021ad50..84754c7 100644 (file)
@@ -1,3 +1,15 @@
+2019-06-25  Sam Weinig  <weinig@apple.com>
+
+        Experiment with simple structured bindings use
+        https://bugs.webkit.org/show_bug.cgi?id=198905
+
+        Reviewed by Darin Adler.
+
+        * wtf/URLHelpers.cpp:
+        (WTF::URLHelpers::mapHostNames):
+        Simplify code using c++ structured bindings (https://en.cppreference.com/w/cpp/language/structured_binding)
+        to see if all the platforms will work with it.
+
 2019-06-25  Adam Barth  <abarth@webkit.org>
 
         [fuchsia] Update to newer zx_clock_get syscall
index f186267..64004ac 100644 (file)
@@ -729,9 +729,7 @@ String mapHostNames(const String& string, const Optional<URLDecodeFunction>& dec
     // Do the mapping.
     String result = string;
     while (!hostNameRanges->isEmpty()) {
-        unsigned location, length;
-        String mappedHostName;
-        std::tie(location, length, mappedHostName) = hostNameRanges->takeLast();
+        auto [location, length, mappedHostName] = hostNameRanges->takeLast();
         result = result.replace(location, length, mappedHostName);
     }
     return result;