Skip to content

Commit

Permalink
fix(sinsp): rename base_table::clear to clear_entries
Browse files Browse the repository at this point in the history
Avoid a naming conflict with sinsp_thread_manager::clear.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
  • Loading branch information
gnosek committed Dec 13, 2024
1 parent c4f4c5b commit a5989b6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion userspace/libsinsp/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ class sinsp_table {
}
}

void clear_entries() { m_table->clear(m_owner_plugin); }
void clear_entries() { m_table->clear_entries(m_owner_plugin); }

private:
libsinsp::state::sinsp_table_owner* m_owner_plugin = nullptr;
Expand Down
5 changes: 3 additions & 2 deletions userspace/libsinsp/plugin_table_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ struct plugin_table_wrapper : public libsinsp::state::table<KeyType> {
ss_plugin_table_iterator_func_t it,
ss_plugin_table_iterator_state_t* s) override;

ss_plugin_rc clear(libsinsp::state::sinsp_table_owner* owner) override;
ss_plugin_rc clear_entries(libsinsp::state::sinsp_table_owner* owner) override;

ss_plugin_rc erase_entry(libsinsp::state::sinsp_table_owner* owner,
const ss_plugin_state_data* key) override;
Expand Down Expand Up @@ -376,7 +376,8 @@ ss_plugin_bool plugin_table_wrapper<KeyType>::iterate_entries(
}

template<typename KeyType>
ss_plugin_rc plugin_table_wrapper<KeyType>::clear(libsinsp::state::sinsp_table_owner* owner) {
ss_plugin_rc plugin_table_wrapper<KeyType>::clear_entries(
libsinsp::state::sinsp_table_owner* owner) {
auto ret = m_input->writer_ext->clear_table(m_input->table);
if(ret == SS_PLUGIN_FAILURE) {
owner->m_last_owner_err = m_owner->get_last_error();
Expand Down
4 changes: 2 additions & 2 deletions userspace/libsinsp/state/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ ss_plugin_bool libsinsp::state::table_accessor::iterate_entries(

ss_plugin_rc libsinsp::state::table_accessor::clear(ss_plugin_table_t* _t) {
auto t = static_cast<table_accessor*>(_t);
return t->m_table->clear(t->m_owner_plugin);
return t->m_table->clear_entries(t->m_owner_plugin);
}

ss_plugin_rc libsinsp::state::table_accessor::erase_entry(ss_plugin_table_t* _t,
Expand Down Expand Up @@ -533,7 +533,7 @@ ss_plugin_bool libsinsp::state::built_in_table<KeyType>::iterate_entries(
}

template<typename KeyType>
ss_plugin_rc libsinsp::state::built_in_table<KeyType>::clear(sinsp_table_owner* owner) {
ss_plugin_rc libsinsp::state::built_in_table<KeyType>::clear_entries(sinsp_table_owner* owner) {
__CATCH_ERR_MSG(owner->m_last_owner_err, {
this->clear_entries();
return SS_PLUGIN_SUCCESS;
Expand Down
4 changes: 2 additions & 2 deletions userspace/libsinsp/state/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class base_table {
ss_plugin_table_iterator_func_t it,
ss_plugin_table_iterator_state_t* s) = 0;

virtual ss_plugin_rc clear(sinsp_table_owner* owner) = 0;
virtual ss_plugin_rc clear_entries(sinsp_table_owner* owner) = 0;

virtual ss_plugin_rc erase_entry(sinsp_table_owner* owner, const ss_plugin_state_data* key) = 0;

Expand Down Expand Up @@ -355,7 +355,7 @@ class built_in_table : public table<KeyType> {
ss_plugin_table_iterator_func_t it,
ss_plugin_table_iterator_state_t* s) override;

ss_plugin_rc clear(sinsp_table_owner* owner) override;
ss_plugin_rc clear_entries(sinsp_table_owner* owner) override;

ss_plugin_rc erase_entry(sinsp_table_owner* owner, const ss_plugin_state_data* key) override;

Expand Down

0 comments on commit a5989b6

Please sign in to comment.