Skip to content

Commit

Permalink
Use PrefixMatch function
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson committed Nov 4, 2023
1 parent cb7e30a commit b17ac28
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ntcore/src/main/native/cpp/LocalStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ void LocalStorage::Impl::NotifyTopic(TopicData* topic,
if (!m_dataloggers.empty()) {
auto now = Now();
for (auto&& datalogger : m_dataloggers) {
if (wpi::starts_with(topic->name, datalogger->prefix) &&
(!datalogger->prefix.empty() ||
!wpi::starts_with(topic->name, '$'))) {
if (PrefixMatch(topic->name, datalogger->prefix, topic->special)) {
auto it = std::find_if(topic->datalogs.begin(), topic->datalogs.end(),
[&](const auto& elem) {
return elem.logger == datalogger->handle;
Expand Down Expand Up @@ -1450,8 +1448,7 @@ NT_DataLogger LocalStorage::StartDataLog(wpi::log::DataLog& log,
// start logging any matching topics
auto now = nt::Now();
for (auto&& topic : m_impl.m_topics) {
if (!wpi::starts_with(topic->name, prefix) ||
(prefix.empty() && wpi::starts_with(topic->name, '$')) ||
if (!PrefixMatch(topic->name, prefix, topic->special) ||
topic->type == NT_UNASSIGNED || topic->typeStr.empty()) {
continue;
}
Expand Down

0 comments on commit b17ac28

Please sign in to comment.