Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 42e690f

Browse filesBrowse files
nodejs-github-botdanielleadams
authored andcommitted
deps: update ada to 2.2.0
PR-URL: #47678 Backport-PR-URL: #48345 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent 08dd271 commit 42e690f
Copy full SHA for 42e690f

File tree

Expand file treeCollapse file tree

3 files changed

+3517
-3580
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+3517
-3580
lines changed
Open diff view settings
Collapse file

‎deps/ada/ada.cpp‎

Copy file name to clipboardExpand all lines: deps/ada/ada.cpp
+41-48Lines changed: 41 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2023-04-17 12:20:41 -0400. Do not edit! */
1+
/* auto-generated on 2023-04-20 18:39:35 -0400. Do not edit! */
22
/* begin file src/ada.cpp */
33
#include "ada.h"
44
/* begin file src/checkers.cpp */
@@ -10501,18 +10501,18 @@ ada_unused std::string get_state(ada::state s) {
1050110501
}
1050210502
}
1050310503

10504-
ada_really_inline std::optional<std::string_view> prune_fragment(
10504+
ada_really_inline std::optional<std::string_view> prune_hash(
1050510505
std::string_view& input) noexcept {
1050610506
// compiles down to 20--30 instructions including a class to memchr (C
1050710507
// function). this function should be quite fast.
1050810508
size_t location_of_first = input.find('#');
1050910509
if (location_of_first == std::string_view::npos) {
1051010510
return std::nullopt;
1051110511
}
10512-
std::string_view fragment = input;
10513-
fragment.remove_prefix(location_of_first + 1);
10512+
std::string_view hash = input;
10513+
hash.remove_prefix(location_of_first + 1);
1051410514
input.remove_suffix(input.size() - location_of_first);
10515-
return fragment;
10515+
return hash;
1051610516
}
1051710517

1051810518
ada_really_inline bool shorten_path(std::string& path,
@@ -10523,9 +10523,9 @@ ada_really_inline bool shorten_path(std::string& path,
1052310523
// If url’s scheme is "file", path’s size is 1, and path[0] is a normalized
1052410524
// Windows drive letter, then return.
1052510525
if (type == ada::scheme::type::FILE &&
10526-
first_delimiter == std::string_view::npos) {
10526+
first_delimiter == std::string_view::npos && !path.empty()) {
1052710527
if (checkers::is_normalized_windows_drive_letter(
10528-
std::string_view(path.data() + 1, first_delimiter - 1))) {
10528+
helpers::substring(path, 1))) {
1052910529
return false;
1053010530
}
1053110531
}
@@ -10547,9 +10547,9 @@ ada_really_inline bool shorten_path(std::string_view& path,
1054710547
// If url’s scheme is "file", path’s size is 1, and path[0] is a normalized
1054810548
// Windows drive letter, then return.
1054910549
if (type == ada::scheme::type::FILE &&
10550-
first_delimiter == std::string_view::npos) {
10550+
first_delimiter == std::string_view::npos && !path.empty()) {
1055110551
if (checkers::is_normalized_windows_drive_letter(
10552-
std::string_view(path.data() + 1, first_delimiter - 1))) {
10552+
helpers::substring(path, 1))) {
1055310553
return false;
1055410554
}
1055510555
}
@@ -10998,8 +10998,8 @@ ada_really_inline void strip_trailing_spaces_from_opaque_path(
1099810998
url_type& url) noexcept {
1099910999
ada_log("helpers::strip_trailing_spaces_from_opaque_path");
1100011000
if (!url.has_opaque_path) return;
11001-
if (url.base_fragment_has_value()) return;
11002-
if (url.base_search_has_value()) return;
11001+
if (url.has_hash()) return;
11002+
if (url.has_search()) return;
1100311003

1100411004
auto path = std::string(url.get_pathname());
1100511005
while (!path.empty() && path.back() == ' ') {
@@ -11451,7 +11451,7 @@ ada_really_inline bool url::parse_scheme(const std::string_view input) {
1145111451

1145211452
// If url includes credentials or has a non-null port, and buffer is
1145311453
// "file", then return.
11454-
if ((includes_credentials() || port.has_value()) &&
11454+
if ((has_credentials() || port.has_value()) &&
1145511455
parsed_type == ada::scheme::type::FILE) {
1145611456
return true;
1145711457
}
@@ -11496,7 +11496,7 @@ ada_really_inline bool url::parse_scheme(const std::string_view input) {
1149611496

1149711497
// If url includes credentials or has a non-null port, and buffer is
1149811498
// "file", then return.
11499-
if ((includes_credentials() || port.has_value()) && _buffer == "file") {
11499+
if ((has_credentials() || port.has_value()) && _buffer == "file") {
1150011500
return true;
1150111501
}
1150211502

@@ -11648,7 +11648,7 @@ std::string url::to_string() const {
1164811648
answer.append("\t\"protocol\":\"");
1164911649
helpers::encode_json(get_protocol(), back);
1165011650
answer.append("\",\n");
11651-
if (includes_credentials()) {
11651+
if (has_credentials()) {
1165211652
answer.append("\t\"username\":\"");
1165311653
helpers::encode_json(username, back);
1165411654
answer.append("\",\n");
@@ -11671,16 +11671,16 @@ std::string url::to_string() const {
1167111671
answer.append("\",\n");
1167211672
answer.append("\t\"opaque path\":");
1167311673
answer.append((has_opaque_path ? "true" : "false"));
11674-
if (base_search_has_value()) {
11674+
if (has_search()) {
1167511675
answer.append(",\n");
1167611676
answer.append("\t\"query\":\"");
1167711677
helpers::encode_json(query.value(), back);
1167811678
answer.append("\"");
1167911679
}
11680-
if (fragment.has_value()) {
11680+
if (hash.has_value()) {
1168111681
answer.append(",\n");
11682-
answer.append("\t\"fragment\":\"");
11683-
helpers::encode_json(fragment.value(), back);
11682+
answer.append("\t\"hash\":\"");
11683+
helpers::encode_json(hash.value(), back);
1168411684
answer.append("\"");
1168511685
}
1168611686
answer.append("\n}");
@@ -11781,9 +11781,8 @@ namespace ada {
1178111781
[[nodiscard]] std::string url::get_hash() const noexcept {
1178211782
// If this’s URL’s fragment is either null or the empty string, then return
1178311783
// the empty string. Return U+0023 (#), followed by this’s URL’s fragment.
11784-
return (!fragment.has_value() || (fragment.value().empty()))
11785-
? ""
11786-
: "#" + fragment.value();
11784+
return (!hash.has_value() || (hash.value().empty())) ? ""
11785+
: "#" + hash.value();
1178711786
}
1178811787

1178911788
} // namespace ada
@@ -11839,7 +11838,7 @@ bool url::set_host_or_hostname(const std::string_view input) {
1183911838
// empty string, and either url includes credentials or url’s port is
1184011839
// non-null, return.
1184111840
else if (host_view.empty() &&
11842-
(is_special() || includes_credentials() || port.has_value())) {
11841+
(is_special() || has_credentials() || port.has_value())) {
1184311842
return false;
1184411843
}
1184511844

@@ -11939,16 +11938,16 @@ bool url::set_port(const std::string_view input) {
1193911938

1194011939
void url::set_hash(const std::string_view input) {
1194111940
if (input.empty()) {
11942-
fragment = std::nullopt;
11941+
hash = std::nullopt;
1194311942
helpers::strip_trailing_spaces_from_opaque_path(*this);
1194411943
return;
1194511944
}
1194611945

1194711946
std::string new_value;
1194811947
new_value = input[0] == '#' ? input.substr(1) : input;
1194911948
helpers::remove_ascii_tab_or_newline(new_value);
11950-
fragment = unicode::percent_encode(
11951-
new_value, ada::character_sets::FRAGMENT_PERCENT_ENCODE);
11949+
hash = unicode::percent_encode(new_value,
11950+
ada::character_sets::FRAGMENT_PERCENT_ENCODE);
1195211951
return;
1195311952
}
1195411953

@@ -12014,7 +12013,7 @@ bool url::set_href(const std::string_view input) {
1201412013
port = out->port;
1201512014
path = out->path;
1201612015
query = out->query;
12017-
fragment = out->fragment;
12016+
hash = out->hash;
1201812017
type = out->type;
1201912018
non_special_scheme = out->non_special_scheme;
1202012019
has_opaque_path = out->has_opaque_path;
@@ -12106,7 +12105,7 @@ result_type parse_url(std::string_view user_input,
1210612105
helpers::trim_c0_whitespace(url_data);
1210712106

1210812107
// Optimization opportunity. Most websites do not have fragment.
12109-
std::optional<std::string_view> fragment = helpers::prune_fragment(url_data);
12108+
std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
1211012109
// We add it last so that an implementation like ada::url_aggregator
1211112110
// can append it last to its internal buffer, thus improving performance.
1211212111

@@ -12463,7 +12462,7 @@ result_type parse_url(std::string_view user_input,
1246312462
// Otherwise, if c is not the EOF code point:
1246412463
else if (input_position != input_size) {
1246512464
// Set url’s query to null.
12466-
url.clear_base_search();
12465+
url.clear_search();
1246712466
if constexpr (result_type_is_ada_url) {
1246812467
// Shorten url’s path.
1246912468
helpers::shorten_path(url.path, url.type);
@@ -12878,7 +12877,7 @@ result_type parse_url(std::string_view user_input,
1287812877
// Otherwise, if c is not the EOF code point:
1287912878
else if (input_position != input_size) {
1288012879
// Set url’s query to null.
12881-
url.clear_base_search();
12880+
url.clear_search();
1288212881

1288312882
// If the code point substring from pointer to the end of input does
1288412883
// not start with a Windows drive letter, then shorten url’s path.
@@ -12895,11 +12894,7 @@ result_type parse_url(std::string_view user_input,
1289512894
// Otherwise:
1289612895
else {
1289712896
// Set url’s path to an empty list.
12898-
if constexpr (result_type_is_ada_url) {
12899-
url.path.clear();
12900-
} else {
12901-
url.clear_base_pathname();
12902-
}
12897+
url.clear_pathname();
1290312898
url.has_opaque_path = true;
1290412899
}
1290512900

@@ -13091,8 +13086,7 @@ template <bool has_state_override>
1309113086

1309213087
// If url includes credentials or has a non-null port, and buffer is
1309313088
// "file", then return.
13094-
if ((includes_credentials() ||
13095-
components.port != url_components::omitted) &&
13089+
if ((has_credentials() || components.port != url_components::omitted) &&
1309613090
parsed_type == ada::scheme::type::FILE) {
1309713091
return true;
1309813092
}
@@ -13115,7 +13109,7 @@ template <bool has_state_override>
1311513109
// If url’s port is url’s scheme’s default port, then set url’s port to
1311613110
// null.
1311713111
if (components.port == urls_scheme_port) {
13118-
clear_base_port();
13112+
clear_port();
1311913113
}
1312013114
}
1312113115
} else { // slow path
@@ -13135,8 +13129,7 @@ template <bool has_state_override>
1313513129

1313613130
// If url includes credentials or has a non-null port, and buffer is
1313713131
// "file", then return.
13138-
if ((includes_credentials() ||
13139-
components.port != url_components::omitted) &&
13132+
if ((has_credentials() || components.port != url_components::omitted) &&
1314013133
_buffer == "file") {
1314113134
return true;
1314213135
}
@@ -13158,7 +13151,7 @@ template <bool has_state_override>
1315813151
// If url’s port is url’s scheme’s default port, then set url’s port to
1315913152
// null.
1316013153
if (components.port == urls_scheme_port) {
13161-
clear_base_port();
13154+
clear_port();
1316213155
}
1316313156
}
1316413157
}
@@ -13339,7 +13332,7 @@ bool url_aggregator::set_port(const std::string_view input) {
1333913332
std::string trimmed(input);
1334013333
helpers::remove_ascii_tab_or_newline(trimmed);
1334113334
if (trimmed.empty()) {
13342-
clear_base_port();
13335+
clear_port();
1334313336
return true;
1334413337
}
1334513338
// Input should not start with control characters.
@@ -13370,7 +13363,7 @@ bool url_aggregator::set_pathname(const std::string_view input) {
1337013363
if (has_opaque_path) {
1337113364
return false;
1337213365
}
13373-
clear_base_pathname();
13366+
clear_pathname();
1337413367
parse_path(input);
1337513368
if (checkers::begins_with(input, "//") && !has_authority() &&
1337613369
!has_dash_dot()) {
@@ -13427,7 +13420,7 @@ void url_aggregator::set_search(const std::string_view input) {
1342713420
ADA_ASSERT_TRUE(validate());
1342813421
ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
1342913422
if (input.empty()) {
13430-
clear_base_search();
13423+
clear_search();
1343113424
helpers::strip_trailing_spaces_from_opaque_path(*this);
1343213425
return;
1343313426
}
@@ -13623,15 +13616,15 @@ bool url_aggregator::set_host_or_hostname(const std::string_view input) {
1362313616
// empty string, and either url includes credentials or url’s port is
1362413617
// non-null, return.
1362513618
else if (host_view.empty() &&
13626-
(is_special() || includes_credentials() ||
13619+
(is_special() || has_credentials() ||
1362713620
components.port != url_components::omitted)) {
1362813621
return false;
1362913622
}
1363013623

1363113624
// Let host be the result of host parsing host_view with url is not special.
1363213625
if (host_view.empty()) {
1363313626
if (has_hostname()) {
13634-
clear_base_hostname(); // easy!
13627+
clear_hostname(); // easy!
1363513628
} else if (has_dash_dot()) {
1363613629
add_authority_slashes_if_needed();
1363713630
delete_dash_dot();
@@ -13657,7 +13650,7 @@ bool url_aggregator::set_host_or_hostname(const std::string_view input) {
1365713650

1365813651
if (new_host.empty()) {
1365913652
// Set url’s host to the empty string.
13660-
clear_base_hostname();
13653+
clear_hostname();
1366113654
} else {
1366213655
// Let host be the result of host parsing buffer with url is not special.
1366313656
if (!parse_host(new_host)) {
@@ -13669,7 +13662,7 @@ bool url_aggregator::set_host_or_hostname(const std::string_view input) {
1366913662
// If host is "localhost", then set host to the empty string.
1367013663
if (helpers::substring(buffer, components.host_start,
1367113664
components.host_end) == "localhost") {
13672-
clear_base_hostname();
13665+
clear_hostname();
1367313666
}
1367413667
}
1367513668
ADA_ASSERT_TRUE(validate());
@@ -13836,7 +13829,7 @@ std::string ada::url_aggregator::to_string() const {
1383613829
helpers::encode_json(get_protocol(), back);
1383713830
answer.append("\",\n");
1383813831

13839-
if (includes_credentials()) {
13832+
if (has_credentials()) {
1384013833
answer.append("\t\"username\":\"");
1384113834
helpers::encode_json(get_username(), back);
1384213835
answer.append("\",\n");

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.