[webkit-changes] [WebKit/WebKit] cc80dc: Stop using Vector::uncheckedAppend() in ISO8601.cpp

Chris Dumez noreply at github.com
Mon Oct 2 08:40:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cc80dcc17dc52a2ec37475a278cc2717c006a9fe
      https://github.com/WebKit/WebKit/commit/cc80dcc17dc52a2ec37475a278cc2717c006a9fe
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-10-02 (Mon, 02 Oct 2023)

  Changed paths:
    M Source/JavaScriptCore/runtime/ISO8601.cpp
    M Source/WTF/wtf/Vector.h
    M Tools/TestWebKitAPI/Tests/WTF/Vector.cpp

  Log Message:
  -----------
  Stop using Vector::uncheckedAppend() in ISO8601.cpp
https://bugs.webkit.org/show_bug.cgi?id=262464

Reviewed by Ryosuke Niwa.

Stop using Vector::uncheckedAppend() in ISO8601.cpp. Vector::uncheckedAppend()
has recently become an alias to Vector::append(), which does bounds checking.

Introduce a more efficient Vector constructor and use it instead. We used to
have a `Vector(const T*, size_t length)` constructor. However, in this case
we want to construct a Vector<LChar> and the input raw pointer may be a UChar*.
To support this, I templated the constructor to make it `Vector(const U*, size_t)`
instead. Note that this matches what we already do for `Vector::append(const U*, size_t)`.

* Source/JavaScriptCore/runtime/ISO8601.cpp:
(JSC::ISO8601::parseTimeZoneBracketedAnnotation):
(JSC::ISO8601::parseCalendar):
* Source/WTF/wtf/Vector.h:
(WTF::Vector::Vector):
* Tools/TestWebKitAPI/Tests/WTF/Vector.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/268731@main




More information about the webkit-changes mailing list