classifier: New function cls_rule_move().
[sliver-openvswitch.git] / lib / classifier.c
index 556278f..93ee977 100644 (file)
@@ -89,7 +89,7 @@ cls_rule_init_from_minimatch(struct cls_rule *rule,
 
 /* Initializes 'dst' as a copy of 'src'.
  *
- * The caller must eventually destroy 'rule' with cls_rule_destroy(). */
+ * The caller must eventually destroy 'dst' with cls_rule_destroy(). */
 void
 cls_rule_clone(struct cls_rule *dst, const struct cls_rule *src)
 {
@@ -97,6 +97,16 @@ cls_rule_clone(struct cls_rule *dst, const struct cls_rule *src)
     dst->priority = src->priority;
 }
 
+/* Initializes 'dst' with the data in 'src', destroying 'src'.
+ *
+ * The caller must eventually destroy 'dst' with cls_rule_destroy(). */
+void
+cls_rule_move(struct cls_rule *dst, struct cls_rule *src)
+{
+    minimatch_move(&dst->match, &src->match);
+    dst->priority = src->priority;
+}
+
 /* Frees memory referenced by 'rule'.  Doesn't free 'rule' itself (it's
  * normally embedded into a larger structure).
  *