Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
14 changes: 7 additions & 7 deletions core/modules/wildcard_match.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,19 +299,19 @@ int WildcardMatch::AddTuple(wm_hkey_t *mask) {
return int(tuples_.size() - 1);
}

int WildcardMatch::DelEntry(int idx, wm_hkey_t *key) {
bool WildcardMatch::DelEntry(int idx, wm_hkey_t *key) {
struct WmTuple &tuple = tuples_[idx];
int ret =
bool ret =
tuple.ht.Remove(*key, wm_hash(total_key_size_), wm_eq(total_key_size_));
if (ret) {
if (ret == false) {
return ret;
}

if (tuple.ht.Count() == 0) {
tuples_.erase(tuples_.begin() + idx);
}

return 0;
return true;
}

CommandResponse WildcardMatch::CommandAdd(
Expand Down Expand Up @@ -368,9 +368,9 @@ CommandResponse WildcardMatch::CommandDelete(
return CommandFailure(-idx, "failed to delete a rule");
}

int ret = DelEntry(idx, &key);
if (ret < 0) {
return CommandFailure(-ret, "failed to delete a rule");
bool ret = DelEntry(idx, &key);
if (ret == false) {
return CommandFailure(-ENOENT, "failed to delete a rule");
}

return CommandSuccess();
Expand Down
2 changes: 1 addition & 1 deletion core/modules/wildcard_match.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class WildcardMatch final : public Module {

int FindTuple(wm_hkey_t *mask);
int AddTuple(wm_hkey_t *mask);
int DelEntry(int idx, wm_hkey_t *key);
bool DelEntry(int idx, wm_hkey_t *key);

void Clear();

Expand Down