Summary: | Refactor URLParser | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Alex Christensen <achristensen> | ||||
Component: | New Bugs | Assignee: | Alex Christensen <achristensen> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | beidson | ||||
Priority: | P2 | ||||||
Version: | WebKit Nightly Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Attachments: |
|
Description
Alex Christensen
2016-09-23 16:23:37 PDT
Created attachment 289717 [details]
Patch
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? (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. (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? (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. |