ovsdb: Refactor code for writing a transaction to a file.
[openvswitch] / ovsdb / column.c
index 0a1f6e4d9fbd612cfc4e0ae1c92d1653d1441f86..58fff1084fd9ae1b8b1bf86ea49a91d86af9f1b7 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)
 {