ovsdb: Add functions to clone schemas.
[sliver-openvswitch.git] / ovsdb / column.c
index 0a1f6e4..58fff10 100644 (file)
@@ -31,6 +31,7 @@ ovsdb_column_create(const char *name, const char *comment,
                     bool mutable, bool persistent,
                     const struct ovsdb_type *type)
 {
+    /* Doesn't set the new column's 'index': the caller must do that. */
     struct ovsdb_column *column;
 
     column = xzalloc(sizeof *column);
@@ -43,6 +44,15 @@ ovsdb_column_create(const char *name, const char *comment,
     return column;
 }
 
+struct ovsdb_column *
+ovsdb_column_clone(const struct ovsdb_column *old)
+{
+    /* Doesn't copy the column's 'index': the caller must do that. */
+    return ovsdb_column_create(old->name, old->comment,
+                               old->mutable, old->persistent,
+                               &old->type);
+}
+
 void
 ovsdb_column_destroy(struct ovsdb_column *column)
 {