Skip to content
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

fix(libsinsp): add function to set compiler filter and filter string #1976

Merged
merged 3 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion userspace/libsinsp/sinsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@
}
#endif // _WIN32

void sinsp::set_filter(std::unique_ptr<sinsp_filter> filter)
void sinsp::set_filter(std::unique_ptr<sinsp_filter> filter, const std::optional<std::string>& filterstring)

Check warning on line 1664 in userspace/libsinsp/sinsp.cpp

View check run for this annotation

Codecov / codecov/patch

userspace/libsinsp/sinsp.cpp#L1664

Added line #L1664 was not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void sinsp::set_filter(std::unique_ptr<sinsp_filter> filter, const std::optional<std::string>& filterstring)
void sinsp::set_filter(std::unique_ptr<sinsp_filter> filter, const std::string& filterstring = "")

I think the previous suggestion was referring to something like this -- otherwise it'd become a breaking change for whoever uses this method.

{
if(m_filter != NULL)
{
Expand All @@ -1670,6 +1670,7 @@
}

m_filter = std::move(filter);
m_filterstring = filterstring.value_or("");
}

void sinsp::set_filter(const std::string& filter)
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/sinsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class SINSP_PUBLIC sinsp : public capture_stats_source

\param filter the runtime filter object
*/
void set_filter(std::unique_ptr<sinsp_filter> filter);
void set_filter(std::unique_ptr<sinsp_filter> filter, const std::optional<std::string>& filterstring);

/*!
\brief Return the filter set for this capture.
Expand Down
Loading