Skip to content

Commit 3ba32f4

Browse files
committed
feat: optimize to_string and resolve compiler warnings
1 parent 667c3cd commit 3ba32f4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/ada/encoding_type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ enum class encoding_type {
2525
/**
2626
* Convert a encoding_type to string.
2727
*/
28-
ada_warn_unused std::string to_string(encoding_type type);
28+
ada_warn_unused const std::string_view to_string(encoding_type type);
2929

3030
} // namespace ada
3131

src/implementation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ template ada::result<url_aggregator> parse<url_aggregator>(
2828
std::string href_from_file(std::string_view input) {
2929
// This is going to be much faster than constructing a URL.
3030
std::string tmp_buffer;
31-
std::string_view internal_input;
31+
std::string_view internal_input{};
3232
if (unicode::has_tabs_or_newline(input)) {
3333
tmp_buffer = input;
3434
helpers::remove_ascii_tab_or_newline(tmp_buffer);
@@ -67,7 +67,7 @@ bool can_parse(std::string_view input, const std::string_view* base_input) {
6767
return result.is_valid;
6868
}
6969

70-
ada_warn_unused std::string to_string(ada::encoding_type type) {
70+
ada_warn_unused const std::string_view to_string(ada::encoding_type type) {
7171
switch (type) {
7272
case ada::encoding_type::UTF8:
7373
return "UTF-8";

0 commit comments

Comments
 (0)