Skip to content

Ada 2.9.1, ada-python 1.15.1 #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions ada_url/ada.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* auto-generated on 2024-07-06 17:38:56 -0400. Do not edit! */
/* auto-generated on 2024-08-24 20:20:43 -0400. Do not edit! */
/* begin file src/ada.cpp */
#include "ada.h"
/* begin file src/checkers.cpp */
Expand Down Expand Up @@ -13830,7 +13830,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
return "null";
}

[[nodiscard]] std::string_view url_aggregator::get_username() const noexcept {
[[nodiscard]] std::string_view url_aggregator::get_username() const noexcept
ada_lifetime_bound {
ada_log("url_aggregator::get_username");
if (has_non_empty_username()) {
return helpers::substring(buffer, components.protocol_end + 2,
Expand All @@ -13839,7 +13840,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
return "";
}

[[nodiscard]] std::string_view url_aggregator::get_password() const noexcept {
[[nodiscard]] std::string_view url_aggregator::get_password() const noexcept
ada_lifetime_bound {
ada_log("url_aggregator::get_password");
if (has_non_empty_password()) {
return helpers::substring(buffer, components.username_end + 1,
Expand All @@ -13848,7 +13850,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
return "";
}

[[nodiscard]] std::string_view url_aggregator::get_port() const noexcept {
[[nodiscard]] std::string_view url_aggregator::get_port() const noexcept
ada_lifetime_bound {
ada_log("url_aggregator::get_port");
if (components.port == url_components::omitted) {
return "";
Expand All @@ -13857,7 +13860,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
components.pathname_start);
}

[[nodiscard]] std::string_view url_aggregator::get_hash() const noexcept {
[[nodiscard]] std::string_view url_aggregator::get_hash() const noexcept
ada_lifetime_bound {
ada_log("url_aggregator::get_hash");
// If this's URL's fragment is either null or the empty string, then return
// the empty string. Return U+0023 (#), followed by this's URL's fragment.
Expand All @@ -13870,7 +13874,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
return helpers::substring(buffer, components.hash_start);
}

[[nodiscard]] std::string_view url_aggregator::get_host() const noexcept {
[[nodiscard]] std::string_view url_aggregator::get_host() const noexcept
ada_lifetime_bound {
ada_log("url_aggregator::get_host");
// Technically, we should check if there is a hostname, but
// the code below works even if there isn't.
Expand All @@ -13888,7 +13893,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
return helpers::substring(buffer, start, components.pathname_start);
}

[[nodiscard]] std::string_view url_aggregator::get_hostname() const noexcept {
[[nodiscard]] std::string_view url_aggregator::get_hostname() const noexcept
ada_lifetime_bound {
ada_log("url_aggregator::get_hostname");
// Technically, we should check if there is a hostname, but
// the code below works even if there isn't.
Expand All @@ -13902,7 +13908,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
return helpers::substring(buffer, start, components.host_end);
}

[[nodiscard]] std::string_view url_aggregator::get_pathname() const noexcept {
[[nodiscard]] std::string_view url_aggregator::get_pathname() const noexcept
ada_lifetime_bound {
ada_log("url_aggregator::get_pathname pathname_start = ",
components.pathname_start, " buffer.size() = ", buffer.size(),
" components.search_start = ", components.search_start,
Expand All @@ -13916,7 +13923,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
return helpers::substring(buffer, components.pathname_start, ending_index);
}

[[nodiscard]] std::string_view url_aggregator::get_search() const noexcept {
[[nodiscard]] std::string_view url_aggregator::get_search() const noexcept
ada_lifetime_bound {
ada_log("url_aggregator::get_search");
// If this's URL's query is either null or the empty string, then return the
// empty string. Return U+003F (?), followed by this's URL's query.
Expand All @@ -13933,7 +13941,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
return helpers::substring(buffer, components.search_start, ending_index);
}

[[nodiscard]] std::string_view url_aggregator::get_protocol() const noexcept {
[[nodiscard]] std::string_view url_aggregator::get_protocol() const noexcept
ada_lifetime_bound {
ada_log("url_aggregator::get_protocol");
return helpers::substring(buffer, 0, components.protocol_end);
}
Expand Down
64 changes: 46 additions & 18 deletions ada_url/ada.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* auto-generated on 2024-07-06 17:38:56 -0400. Do not edit! */
/* auto-generated on 2024-08-24 20:20:43 -0400. Do not edit! */
/* begin file include/ada.h */
/**
* @file ada.h
Expand Down Expand Up @@ -479,6 +479,18 @@ namespace ada {
#define ADA_NEON 1
#endif

#ifndef __has_cpp_attribute
#define ada_lifetime_bound
#elif __has_cpp_attribute(msvc::lifetimebound)
#define ada_lifetime_bound [[msvc::lifetimebound]]
#elif __has_cpp_attribute(clang::lifetimebound)
#define ada_lifetime_bound [[clang::lifetimebound]]
#elif __has_cpp_attribute(lifetimebound)
#define ada_lifetime_bound [[lifetimebound]]
#else
#define ada_lifetime_bound
#endif

#endif // ADA_COMMON_DEFS_H
/* end file include/ada/common_defs.h */
#include <cstdint>
Expand Down Expand Up @@ -4845,35 +4857,38 @@ struct url_aggregator : url_base {
* @see https://url.spec.whatwg.org/#dom-url-href
* @see https://url.spec.whatwg.org/#concept-url-serializer
*/
[[nodiscard]] inline std::string_view get_href() const noexcept;
[[nodiscard]] inline std::string_view get_href() const noexcept
ada_lifetime_bound;
/**
* The username getter steps are to return this's URL's username.
* This function does not allocate memory.
* @return a lightweight std::string_view.
* @see https://url.spec.whatwg.org/#dom-url-username
*/
[[nodiscard]] std::string_view get_username() const noexcept;
[[nodiscard]] std::string_view get_username() const noexcept
ada_lifetime_bound;
/**
* The password getter steps are to return this's URL's password.
* This function does not allocate memory.
* @return a lightweight std::string_view.
* @see https://url.spec.whatwg.org/#dom-url-password
*/
[[nodiscard]] std::string_view get_password() const noexcept;
[[nodiscard]] std::string_view get_password() const noexcept
ada_lifetime_bound;
/**
* Return this's URL's port, serialized.
* This function does not allocate memory.
* @return a lightweight std::string_view.
* @see https://url.spec.whatwg.org/#dom-url-port
*/
[[nodiscard]] std::string_view get_port() const noexcept;
[[nodiscard]] std::string_view get_port() const noexcept ada_lifetime_bound;
/**
* Return U+0023 (#), followed by this's URL's fragment.
* This function does not allocate memory.
* @return a lightweight std::string_view..
* @see https://url.spec.whatwg.org/#dom-url-hash
*/
[[nodiscard]] std::string_view get_hash() const noexcept;
[[nodiscard]] std::string_view get_hash() const noexcept ada_lifetime_bound;
/**
* Return url's host, serialized, followed by U+003A (:) and url's port,
* serialized.
Expand All @@ -4882,23 +4897,25 @@ struct url_aggregator : url_base {
* @return a lightweight std::string_view.
* @see https://url.spec.whatwg.org/#dom-url-host
*/
[[nodiscard]] std::string_view get_host() const noexcept;
[[nodiscard]] std::string_view get_host() const noexcept ada_lifetime_bound;
/**
* Return this's URL's host, serialized.
* This function does not allocate memory.
* When there is no host, this function returns the empty view.
* @return a lightweight std::string_view.
* @see https://url.spec.whatwg.org/#dom-url-hostname
*/
[[nodiscard]] std::string_view get_hostname() const noexcept;
[[nodiscard]] std::string_view get_hostname() const noexcept
ada_lifetime_bound;
/**
* The pathname getter steps are to return the result of URL path serializing
* this's URL.
* This function does not allocate memory.
* @return a lightweight std::string_view.
* @see https://url.spec.whatwg.org/#dom-url-pathname
*/
[[nodiscard]] std::string_view get_pathname() const noexcept;
[[nodiscard]] std::string_view get_pathname() const noexcept
ada_lifetime_bound;
/**
* Compute the pathname length in bytes without instantiating a view or a
* string.
Expand All @@ -4912,15 +4929,16 @@ struct url_aggregator : url_base {
* @return a lightweight std::string_view.
* @see https://url.spec.whatwg.org/#dom-url-search
*/
[[nodiscard]] std::string_view get_search() const noexcept;
[[nodiscard]] std::string_view get_search() const noexcept ada_lifetime_bound;
/**
* The protocol getter steps are to return this's URL's scheme, followed by
* U+003A (:).
* This function does not allocate memory.
* @return a lightweight std::string_view.
* @see https://url.spec.whatwg.org/#dom-url-protocol
*/
[[nodiscard]] std::string_view get_protocol() const noexcept;
[[nodiscard]] std::string_view get_protocol() const noexcept
ada_lifetime_bound;

/**
* A URL includes credentials if its username or password is not the empty
Expand Down Expand Up @@ -5828,7 +5846,7 @@ inline void url::set_scheme(std::string &&new_scheme) noexcept {
type = ada::scheme::get_scheme_type(new_scheme);
// We only move the 'scheme' if it is non-special.
if (!is_special()) {
non_special_scheme = new_scheme;
non_special_scheme = std::move(new_scheme);
}
}

Expand Down Expand Up @@ -5877,10 +5895,15 @@ inline void url::copy_scheme(const ada::url &u) {
ada_really_inline size_t url::parse_port(std::string_view view,
bool check_trailing_content) noexcept {
ada_log("parse_port('", view, "') ", view.size());
if (!view.empty() && view[0] == '-') {
ada_log("parse_port: view[0] == '0' && view.size() > 1");
is_valid = false;
return 0;
}
uint16_t parsed_port{};
auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
if (r.ec == std::errc::result_out_of_range) {
ada_log("parse_port: std::errc::result_out_of_range");
ada_log("parse_port: r.ec == std::errc::result_out_of_range");
is_valid = false;
return 0;
}
Expand Down Expand Up @@ -6776,19 +6799,24 @@ inline bool url_aggregator::has_port() const noexcept {
buffer[components.host_end + 1] == '.';
}

[[nodiscard]] inline std::string_view url_aggregator::get_href()
const noexcept {
[[nodiscard]] inline std::string_view url_aggregator::get_href() const noexcept
ada_lifetime_bound {
ada_log("url_aggregator::get_href");
return buffer;
}

ada_really_inline size_t url_aggregator::parse_port(
std::string_view view, bool check_trailing_content) noexcept {
ada_log("url_aggregator::parse_port('", view, "') ", view.size());
if (!view.empty() && view[0] == '-') {
ada_log("parse_port: view[0] == '0' && view.size() > 1");
is_valid = false;
return 0;
}
uint16_t parsed_port{};
auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
if (r.ec == std::errc::result_out_of_range) {
ada_log("parse_port: std::errc::result_out_of_range");
ada_log("parse_port: r.ec == std::errc::result_out_of_range");
is_valid = false;
return 0;
}
Expand Down Expand Up @@ -7279,14 +7307,14 @@ url_search_params_entries_iter::next() {
#ifndef ADA_ADA_VERSION_H
#define ADA_ADA_VERSION_H

#define ADA_VERSION "2.9.0"
#define ADA_VERSION "2.9.1"

namespace ada {

enum {
ADA_VERSION_MAJOR = 2,
ADA_VERSION_MINOR = 9,
ADA_VERSION_REVISION = 0,
ADA_VERSION_REVISION = 1,
};

} // namespace ada
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "ada-url"
version = "1.15.0"
version = "1.15.1"
authors = [
{name = "Bo Bayles", email = "[email protected]"},
]
Expand Down
Loading
Loading