Skip to content

Commit a279ed8

Browse files
authored
Removing optimization that never got used (#416)
* contains_forbidden_domain_code_point_or_upper should return uint8_t * Removing dead code. * stupid formatting. * Another silly reformat
1 parent 81ffcb7 commit a279ed8

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

include/ada/unicode.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ ada_really_inline constexpr bool contains_forbidden_domain_code_point(
9494
* then the second bit is set to 1.
9595
* @see https://url.spec.whatwg.org/#forbidden-domain-code-point
9696
*/
97-
ada_really_inline constexpr bool contains_forbidden_domain_code_point_or_upper(
98-
const char* input, size_t length) noexcept;
97+
ada_really_inline constexpr uint8_t
98+
contains_forbidden_domain_code_point_or_upper(const char* input,
99+
size_t length) noexcept;
99100

100101
/**
101102
* Checks if the input is a forbidden doamin code point.

src/unicode.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,9 @@ static_assert(sizeof(is_forbidden_domain_code_point_table_or_upper) == 256);
223223
static_assert(is_forbidden_domain_code_point_table_or_upper[uint8_t('A')] == 2);
224224
static_assert(is_forbidden_domain_code_point_table_or_upper[uint8_t('Z')] == 2);
225225

226-
ada_really_inline constexpr bool contains_forbidden_domain_code_point_or_upper(
227-
const char* input, size_t length) noexcept {
226+
ada_really_inline constexpr uint8_t
227+
contains_forbidden_domain_code_point_or_upper(const char* input,
228+
size_t length) noexcept {
228229
size_t i = 0;
229230
uint8_t accumulator{};
230231
for (; i + 4 <= length; i += 4) {

src/url_aggregator.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -479,22 +479,6 @@ ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
479479
}
480480
ada_log("parse_host fast path ", get_hostname());
481481
return true;
482-
} else if (is_forbidden_or_upper == 2) {
483-
// We have encountered at least one upper case ASCII letter, let us
484-
// try to convert it to lower case. If there is no 'xn-' in the result,
485-
// we can then use a secondary fast path.
486-
std::string _buffer = std::string(input);
487-
unicode::to_lower_ascii(_buffer.data(), _buffer.size());
488-
if (input.find("xn-") == std::string_view::npos) {
489-
// secondary fast path when input is not all lower case
490-
update_base_hostname(input);
491-
if (checkers::is_ipv4(get_hostname())) {
492-
ada_log("parse_host fast path ipv4");
493-
return parse_ipv4(get_hostname());
494-
}
495-
ada_log("parse_host fast path ", get_hostname());
496-
return true;
497-
}
498482
}
499483
// We have encountered at least one forbidden code point or the input contains
500484
// 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full

0 commit comments

Comments
 (0)