From e65dc5c57e4520d838350607d256f251e4d81235 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 13 Oct 2010 17:14:57 -0700 Subject: [PATCH] classifier: Remove unused functions cls_rule_moved(), cls_rule_replace(). In preparation for rewriting the classifier, remove some functions that nothing uses and have no tests. --- lib/classifier.c | 49 ------------------------------------------------ lib/classifier.h | 4 ---- 2 files changed, 53 deletions(-) diff --git a/lib/classifier.c b/lib/classifier.c index a5eccf53..38a5e2bc 100644 --- a/lib/classifier.c +++ b/lib/classifier.c @@ -103,55 +103,6 @@ cls_rule_print(const struct cls_rule *rule) flow_print(stdout, &rule->flow); putc('\n', stdout); } - -/* Adjusts pointers around 'old', which must be in classifier 'cls', to - * compensate for it having been moved in memory to 'new' (e.g. due to - * realloc()). - * - * This function cannot be realized in all possible flow classifier - * implementations, so we will probably have to change the interface if we - * change the implementation. Shouldn't be a big deal though. */ -void -cls_rule_moved(struct classifier *cls, struct cls_rule *old, - struct cls_rule *new) -{ - if (old != new) { - if (new->wc.wildcards) { - list_moved(&new->node.list); - } else { - hmap_node_moved(&cls->exact_table, - &old->node.hmap, &new->node.hmap); - } - } -} - -/* Replaces 'old', which must be in classifier 'cls', by 'new' (e.g. due to - * realloc()); that is, after calling this function 'new' will be in 'cls' in - * place of 'old'. - * - * 'new' and 'old' must be exactly the same: wildcard the same fields, have the - * same fixed values for non-wildcarded fields, and have the same priority. - * - * The caller takes ownership of 'old' and is thus responsible for freeing it, - * etc., as necessary. - * - * This function cannot be realized in all possible flow classifier - * implementations, so we will probably have to change the interface if we - * change the implementation. Shouldn't be a big deal though. */ -void -cls_rule_replace(struct classifier *cls, const struct cls_rule *old, - struct cls_rule *new) -{ - assert(old != new); - assert(old->wc.wildcards == new->wc.wildcards); - assert(old->priority == new->priority); - - if (new->wc.wildcards) { - list_replace(&new->node.list, &old->node.list); - } else { - hmap_replace(&cls->exact_table, &old->node.hmap, &new->node.hmap); - } -} /* Initializes 'cls' as a classifier that initially contains no classification * rules. */ diff --git a/lib/classifier.h b/lib/classifier.h index c555efe8..3ad69e00 100644 --- a/lib/classifier.h +++ b/lib/classifier.h @@ -130,10 +130,6 @@ void cls_rule_from_match(const struct ofp_match *, unsigned int priority, struct cls_rule *); char *cls_rule_to_string(const struct cls_rule *); void cls_rule_print(const struct cls_rule *); -void cls_rule_moved(struct classifier *, - struct cls_rule *old, struct cls_rule *new); -void cls_rule_replace(struct classifier *, const struct cls_rule *old, - struct cls_rule *new); void classifier_init(struct classifier *); void classifier_destroy(struct classifier *); -- 2.30.2