WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
73622
Eliminate Duplicate word at a time equal code in StringImpl.cpp and StringHash.h
https://bugs.webkit.org/show_bug.cgi?id=73622
Summary
Eliminate Duplicate word at a time equal code in StringImpl.cpp and StringHash.h
Michael Saboff
Reported
2011-12-01 22:17:33 PST
Both wtf/text/StringHash.h and wtf/text/StringImpl.cpp contain platform specific code to implement equal comparison of two character arrays. These two versions should be merged together into a common implementation.
Attachments
Patch
(15.11 KB, patch)
2011-12-12 14:13 PST
,
Michael Saboff
oliver
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Michael Saboff
Comment 1
2011-12-12 14:13:04 PST
Created
attachment 118843
[details]
Patch
Oliver Hunt
Comment 2
2011-12-12 15:16:33 PST
Comment on
attachment 118843
[details]
Patch r=me
Michael Saboff
Comment 3
2011-12-12 15:22:08 PST
Committed
r102631
: <
http://trac.webkit.org/changeset/102631
>
Darin Adler
Comment 4
2011-12-13 08:54:19 PST
Comment on
attachment 118843
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=118843&action=review
> Source/JavaScriptCore/wtf/text/AtomicString.h:142 > +inline bool operator==(const AtomicString& a, const Vector<UChar>& b) { return a.impl() && equal(static_cast<StringImpl*>(a.impl()), b.data(), b.size()); }
Why is the cast needed?
> Source/JavaScriptCore/wtf/text/StringImpl.h:566 > +template <typename CharTypeL, typename CharTypeR> > + ALWAYS_INLINE bool equal(const CharTypeL*, const CharTypeR*, unsigned);
We don’t normally implement the second line like this. I think that this is too broad an overload for equal. It will allow you to pass any two pointers, including pointers to that aren’t even character types. Instead, I suggest overloading the equal function for all the combinations.
Darin Adler
Comment 5
2011-12-13 08:54:38 PST
(In reply to
comment #4
)
> > Source/JavaScriptCore/wtf/text/StringImpl.h:566 > > +template <typename CharTypeL, typename CharTypeR> > > + ALWAYS_INLINE bool equal(const CharTypeL*, const CharTypeR*, unsigned); > > We don’t normally indent the second line like this.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug