RESOLVED FIXED 162518
Refactor URLParser
https://bugs.webkit.org/show_bug.cgi?id=162518
Summary Refactor URLParser
Alex Christensen
Reported 2016-09-23 16:23:37 PDT
Refactor URLParser
Attachments
Patch (33.81 KB, patch)
2016-09-23 16:27 PDT, Alex Christensen
beidson: review+
Alex Christensen
Comment 1 2016-09-23 16:27:30 PDT
Brady Eidson
Comment 2 2016-09-23 16:30:54 PDT
Comment on attachment 289717 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=289717&action=review > Source/WebCore/platform/URLParser.h:86 > + using IPv4Address = uint32_t; Is 'using' preferred over typedef? > Source/WebCore/platform/URLParser.h:89 > + using IPv6Address = std::array<uint16_t, 8>; Why std::array instead of Vector?
Alex Christensen
Comment 3 2016-09-23 16:32:43 PDT
(In reply to comment #2) > Comment on attachment 289717 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=289717&action=review > > > Source/WebCore/platform/URLParser.h:86 > > + using IPv4Address = uint32_t; > > Is 'using' preferred over typedef? Yes. It works better with templates. > > > Source/WebCore/platform/URLParser.h:89 > > + using IPv6Address = std::array<uint16_t, 8>; > > Why std::array instead of Vector? We know it will have exactly 8 and only 8 elements. No reason to keep track of size, and no reason to have capability of having more or less. I would use an array, but that doesn't work as a template parameter.
Brady Eidson
Comment 4 2016-09-23 16:42:14 PDT
(In reply to comment #3) > (In reply to comment #2) > > Comment on attachment 289717 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=289717&action=review > > > > > Source/WebCore/platform/URLParser.h:86 > > > + using IPv4Address = uint32_t; > > > > Is 'using' preferred over typedef? > Yes. It works better with templates. > > > > > Source/WebCore/platform/URLParser.h:89 > > > + using IPv6Address = std::array<uint16_t, 8>; > > > > Why std::array instead of Vector? > We know it will have exactly 8 and only 8 elements. Vector with inline capacity accomplishes the same thing, no?
Alex Christensen
Comment 5 2016-09-23 16:43:18 PDT
Alex Christensen
Comment 6 2016-09-23 16:43:44 PDT
(In reply to comment #4) > Vector with inline capacity accomplishes the same thing, no? This has an unneeded unsigned value next to the values I care about.
Note You need to log in before you can comment on or make changes to this bug.