Replace mozilla::{ArrayLength,ArrayEnd} with STL functions
Categories
(Core :: JavaScript Engine, task, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox86 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(7 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
mozilla::ArrayLength()on string constants can be replaced withstd::char_traits::length().mozilla::ArrayLength()in simple for-loops can be replaced with ranged for-loops.- In all other cases,
mozilla::ArrayLength()can be replaced withstd::size(). mozilla::ArrayEnd()can be replaced withstd::end().
| Assignee | ||
Comment 1•5 years ago
|
||
Replaces calls to mozilla::ArrayLength with ranged for-loops.
| Assignee | ||
Comment 2•5 years ago
|
||
Calling mozilla::ArrayLength() on strings requires to subtract one to account
for the trailing null-character. This isn't necessary when
std::char_traits<T>::length() is used.
constexpr evaluation of std::char_traits<T>::length() requires its input to
be a constexpr string. A handful of strings were therefore changed from const
to constexpr.
Depends on D102295
| Assignee | ||
Comment 3•5 years ago
|
||
We're already using the constexpr calls to std::char_traits<T>::length() in
other code, so this fallback code doesn't seem necessary anymore.
(The code in "NumberFormat.cpp" predates the GCC version bump in bug 1536848.)
Depends on D102296
| Assignee | ||
Comment 4•5 years ago
|
||
Replace all other uses of mozilla::ArrayLength() with the stl function
std::size().
Depends on D102297
| Assignee | ||
Comment 5•5 years ago
|
||
Replace mozilla::ArrayEnd() with the stl function std::end().
Depends on D102299
| Assignee | ||
Comment 6•5 years ago
|
||
Instead of just replace mozilla::ArrayLength with std::size, replace the
whole loop statement with a call to std::find_if.
Depends on D102300
| Assignee | ||
Comment 7•5 years ago
|
||
Only include "mozilla/ArrayUtils.h" when actually needed.
Depends on D102304
Updated•5 years ago
|
Updated•5 years ago
|
Comment 9•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/998d5f1f185a
https://hg.mozilla.org/mozilla-central/rev/decc251d4c7b
https://hg.mozilla.org/mozilla-central/rev/8cfea455f0e0
https://hg.mozilla.org/mozilla-central/rev/91f481d8546c
https://hg.mozilla.org/mozilla-central/rev/ad1e8f06cfee
https://hg.mozilla.org/mozilla-central/rev/9be1510d9e83
https://hg.mozilla.org/mozilla-central/rev/0933f32abb68
Description
•