WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
46509
Add operator == for AtomicString and Vector<Uchar>
https://bugs.webkit.org/show_bug.cgi?id=46509
Summary
Add operator == for AtomicString and Vector<Uchar>
Erik Arvidsson
Reported
2010-09-24 14:13:55 PDT
Add operator == for AtomicString and Vector<Uchar>
Attachments
Patch
(3.24 KB, patch)
2010-09-24 14:28 PDT
,
Erik Arvidsson
no flags
Details
Formatted Diff
Diff
Patch
(2.46 KB, patch)
2010-09-24 18:38 PDT
,
Erik Arvidsson
no flags
Details
Formatted Diff
Diff
Patch
(3.61 KB, patch)
2010-09-27 11:46 PDT
,
Erik Arvidsson
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Erik Arvidsson
Comment 1
2010-09-24 14:28:00 PDT
Created
attachment 68749
[details]
Patch
Erik Arvidsson
Comment 2
2010-09-24 18:10:58 PDT
Darin suggested that I added this function in
bug 20709
.
Darin Adler
Comment 3
2010-09-24 18:21:54 PDT
Comment on
attachment 68749
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=68749&action=review
> JavaScriptCore/wtf/text/AtomicString.cpp:159 > +bool operator==(const AtomicString& a, const Vector<UChar>& b)
Unlike strings, there is no concept of a null vector as distinct from an empty vector, so there should not be code here checking b.data() for null.
> JavaScriptCore/wtf/text/AtomicString.cpp:161 > + StringImpl* impl = a.impl();
It doesn’t help readability or efficiency to put this into a local variable.
> JavaScriptCore/wtf/text/AtomicString.cpp:163 > + if ((!impl || !impl->characters()) && !s)
There’s no need to check null impl->characters().
> JavaScriptCore/wtf/text/AtomicString.cpp:167 > + return equal(impl, s, b.size());
This whole function can just be: return a.impl() && equal(a.impl(), b.data(), b.size()); No need for any other null checks.
Erik Arvidsson
Comment 4
2010-09-24 18:38:57 PDT
Created
attachment 68799
[details]
Patch
Darin Adler
Comment 5
2010-09-24 18:45:13 PDT
Comment on
attachment 68799
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=68799&action=review
> JavaScriptCore/wtf/text/AtomicString.h:129 > +inline bool operator==(const AtomicString& a, const Vector<UChar>& b) { return a.impl() && equal(a.impl(), b.data(), b.size()); }
Oops! This won’t compile. The equal function this calls is inside AtomicString.cpp and private to the cpp file, not exposed to the header at all.
Erik Arvidsson
Comment 6
2010-09-24 18:46:41 PDT
Comment on
attachment 68799
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=68799&action=review
>> JavaScriptCore/wtf/text/AtomicString.h:129 >> +inline bool operator==(const AtomicString& a, const Vector<UChar>& b) { return a.impl() && equal(a.impl(), b.data(), b.size()); } > > Oops! This won’t compile. The equal function this calls is inside AtomicString.cpp and private to the cpp file, not exposed to the header at all.
Yeah, I apologize for that patch upload. I'm moving it to the cpp and compiling and testing again.
Eric Seidel (no email)
Comment 7
2010-09-24 19:05:12 PDT
Attachment 68799
[details]
did not build on mac: Build output:
http://queues.webkit.org/results/4061109
Erik Arvidsson
Comment 8
2010-09-27 11:46:44 PDT
Created
attachment 68937
[details]
Patch
Darin Adler
Comment 9
2010-09-27 11:47:34 PDT
Comment on
attachment 68937
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=68937&action=review
> JavaScriptCore/wtf/text/AtomicString.cpp:158 > } > +bool operator==(const AtomicString& a, const Vector<UChar>& b)
There should be a blank line there. We could use the names "string" and "vector" instead of "a" and "b" here.
Erik Arvidsson
Comment 10
2010-09-27 12:22:40 PDT
Comment on
attachment 68937
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=68937&action=review
Thanks for your patience.
>> JavaScriptCore/wtf/text/AtomicString.cpp:158 >> +bool operator==(const AtomicString& a, const Vector<UChar>& b) > > There should be a blank line there. > > We could use the names "string" and "vector" instead of "a" and "b" here.
Done and done.
Erik Arvidsson
Comment 11
2010-09-27 13:43:56 PDT
Committed
r68422
: <
http://trac.webkit.org/changeset/68422
>
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