The primary purpose of cls_rule_moved() is to deal gracefully with memory
blocks that have been realloc()'d. realloc() can return the original
memory block so it's best to tolerate that instead of assert-failing.
cls_rule_moved(struct classifier *cls, struct cls_rule *old,
struct cls_rule *new)
{
- assert(old != new);
- if (new->wc.wildcards) {
- list_moved(&new->node.list);
- } else {
- hmap_moved(&cls->exact_table, &old->node.hmap, &new->node.hmap);
+ if (old != new) {
+ if (new->wc.wildcards) {
+ list_moved(&new->node.list);
+ } else {
+ hmap_moved(&cls->exact_table, &old->node.hmap, &new->node.hmap);
+ }
}
}