refactor: remove tr_quark_convert() (#8009)

* refactor: remove tr_quark_convert() call from makeState()

* refactor: remove tr_quark_convert() call from tr_variant::merge()

* refactor: remove tr_quark_convert()
This commit is contained in:
Charles Kerr
2025-12-25 14:53:51 -06:00
committed by GitHub
parent ae44cacc31
commit 64f9c512da
3 changed files with 5 additions and 19 deletions

View File

@@ -486,8 +486,10 @@ struct State
if (auto const method = top.value_if<std::string_view>(TR_KEY_method))
{
auto const key = tr_quark_convert(tr_quark_new(*method));
state.is_torrent = key == TR_KEY_torrent_get || key == TR_KEY_torrent_set;
auto const key = tr_quark_lookup(*method);
state.is_torrent = key &&
(*key == TR_KEY_torrent_get || *key == TR_KEY_torrent_get_kebab || *key == TR_KEY_torrent_set ||
*key == TR_KEY_torrent_set_kebab_APICOMPAT);
}
if (state.is_response)
@@ -922,12 +924,3 @@ void convert_incoming_data(tr_variant& var)
convert(var, Style::Tr5);
}
} // namespace libtransmission::api_compat
tr_quark tr_quark_convert(tr_quark const quark)
{
using namespace libtransmission::api_compat;
auto state = State{};
state.style = Style::Tr5;
return convert_key(state, quark);
}

View File

@@ -26,10 +26,3 @@ void convert_incoming_data(tr_variant& var);
void convert_outgoing_data(tr_variant& var);
} // namespace libtransmission::api_compat
/**
* Get the replacement quark from old deprecated quarks.
*
* Note: Temporary shim just for the transition period to snake_case.
*/
[[nodiscard]] tr_quark tr_quark_convert(tr_quark quark);

View File

@@ -222,7 +222,7 @@ tr_variant& tr_variant::merge(tr_variant const& that)
dest->reserve(std::size(*dest) + std::size(value));
for (auto const& [key, child] : value)
{
(*dest)[tr_quark_convert(key)].merge(child);
(*dest)[key].merge(child);
}
}
}