X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ovsdb%2Fcolumn.c;h=dc93dc71b7fdcb9b6bdf187c15b8b6480ea8e165;hb=45a7de56bbcb2adfabf2082b1133e768777d44d6;hp=1e8a2d09d6b75cde68ab00935fac4190bb6f3996;hpb=f85f8ebbfac946c19b3c6eb0f4170f579d0a4d25;p=openvswitch diff --git a/ovsdb/column.c b/ovsdb/column.c index 1e8a2d09..dc93dc71 100644 --- a/ovsdb/column.c +++ b/ovsdb/column.c @@ -31,16 +31,16 @@ ovsdb_column_create(const char *name, const char *comment, bool mutable, bool persistent, const struct ovsdb_type *type) { - struct ovsdb_column *ts; + struct ovsdb_column *column; - ts = xzalloc(sizeof *ts); - ts->name = xstrdup(name); - ts->comment = comment ? xstrdup(comment) : NULL; - ts->mutable = mutable; - ts->persistent = persistent; - ts->type = *type; + column = xzalloc(sizeof *column); + column->name = xstrdup(name); + column->comment = comment ? xstrdup(comment) : NULL; + column->mutable = mutable; + column->persistent = persistent; + column->type = *type; - return ts; + return column; } void @@ -174,6 +174,19 @@ error: "array of distinct column names expected"); } +struct json * +ovsdb_column_set_to_json(const struct ovsdb_column_set *set) +{ + struct json *json; + size_t i; + + json = json_array_create_empty(); + for (i = 0; i < set->n_columns; i++) { + json_array_add(json, json_string_create(set->columns[i]->name)); + } + return json; +} + void ovsdb_column_set_add(struct ovsdb_column_set *set, const struct ovsdb_column *column)