ovsdb-idl: Add assertion for synthetic records in ovsdb_idl_read().
authorBen Pfaff <blp@nicira.com>
Tue, 15 Nov 2011 21:59:41 +0000 (13:59 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 23 Nov 2011 23:32:37 +0000 (15:32 -0800)
This function doesn't support synthetic records but it probably isn't
obvious from looking at it, so add an actual assertion.

lib/ovsdb-idl.c

index 439a40a1e66cadecb197c0c7a336309a6b837b4f..19ae16fe54d0282b6bf3ae249dea6cbbce60db8e 100644 (file)
@@ -1112,8 +1112,13 @@ const struct ovsdb_datum *
 ovsdb_idl_read(const struct ovsdb_idl_row *row,
                const struct ovsdb_idl_column *column)
 {
-    const struct ovsdb_idl_table_class *class = row->table->class;
-    size_t column_idx = column - class->columns;
+    const struct ovsdb_idl_table_class *class;
+    size_t column_idx;
+
+    assert(!ovsdb_idl_row_is_synthetic(row));
+
+    class = row->table->class;
+    column_idx = column - class->columns;
 
     assert(row->new != NULL);
     assert(column_idx < class->n_columns);