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
95888
More fixes for String::operator+=() in Debug mode
https://bugs.webkit.org/show_bug.cgi?id=95888
Summary
More fixes for String::operator+=() in Debug mode
Patrick R. Gansterer
Reported
2012-09-05 13:51:35 PDT
More fixes for String::operator+=() in Debug mode
Attachments
Patch
(9.31 KB, patch)
2012-09-05 13:55 PDT
,
Patrick R. Gansterer
paroga
: review-
Details
Formatted Diff
Diff
Patch
(9.56 KB, patch)
2012-09-05 14:08 PDT
,
Patrick R. Gansterer
abarth
: review+
Details
Formatted Diff
Diff
Patch
(10.67 KB, patch)
2012-09-05 14:17 PDT
,
Patrick R. Gansterer
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Patrick R. Gansterer
Comment 1
2012-09-05 13:55:37 PDT
Created
attachment 162325
[details]
Patch
Patrick R. Gansterer
Comment 2
2012-09-05 14:03:07 PDT
Comment on
attachment 162325
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=162325&action=review
> Source/WebCore/editing/VisibleSelection.cpp:678 > result = "<none>";
won't work
Adam Barth
Comment 3
2012-09-05 14:03:50 PDT
Comment on
attachment 162325
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=162325&action=review
> Source/WebCore/dom/Element.cpp:1421 > + strncpy(buffer, result.toString().utf8().data(), length - 1);
We should explicitly NUL terminate buffer in case we hit the length limit, but that's something for another patch.
> Source/WebCore/dom/Node.cpp:2105 > + if (!attr.isEmpty()) > + string.append(attrDesc + attr);
It's more efficient to do this in two operations. Having the + as a separate operation creates an intermediate buffer that's not needed.
> Source/WebCore/dom/Node.cpp:2198 > - traverseTreeAndMark(indent + "\t", youngerShadowRoot, markedNode1, markedLabel1, markedNode2, markedLabel2); > + traverseTreeAndMark(indent.toString() + '\t', youngerShadowRoot, markedNode1, markedLabel1, markedNode2, markedLabel2);
It's more efficient to append the '\t' and then call toString.
> Source/WebCore/dom/Node.cpp:2200 > - traverseTreeAndMark(indent + "\t", oldestShadowRoot, markedNode1, markedLabel1, markedNode2, markedLabel2); > + traverseTreeAndMark(indent.toString() + '\t', oldestShadowRoot, markedNode1, markedLabel1, markedNode2, markedLabel2);
ditto
> Source/WebCore/dom/Node.cpp:2222 > + if (s.length())
if (!s.isEmpty())
Patrick R. Gansterer
Comment 4
2012-09-05 14:08:49 PDT
Created
attachment 162329
[details]
Patch
Patrick R. Gansterer
Comment 5
2012-09-05 14:10:32 PDT
Comment on
attachment 162329
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=162329&action=review
> Source/WebCore/dom/Node.cpp:2105 > + string.append(attrDesc + attr);
string is an out-parameter are two String::append() calls better than one append and operator+()?
Adam Barth
Comment 6
2012-09-05 14:12:54 PDT
Comment on
attachment 162329
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=162329&action=review
>> Source/WebCore/dom/Node.cpp:2105 >> + string.append(attrDesc + attr); > > string is an out-parameter > are two String::append() calls better than one append and operator+()?
Can we change the outparameter type to StringBuilder?
Patrick R. Gansterer
Comment 7
2012-09-05 14:17:49 PDT
Created
attachment 162333
[details]
Patch
Adam Barth
Comment 8
2012-09-06 00:46:34 PDT
Comment on
attachment 162333
[details]
Patch Clearing flags on attachment: 162333 Committed
r127706
: <
http://trac.webkit.org/changeset/127706
>
Adam Barth
Comment 9
2012-09-06 00:46:36 PDT
All reviewed patches have been landed. Closing bug.
Chris Dumez
Comment 10
2012-09-06 01:54:08 PDT
***
Bug 95945
has been marked as a duplicate of this bug. ***
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