[ovs-dev] [Simple DB Stats 05/11] ovsdb-idl: Drop unnecessary allocation from ovsdb_idl_txn_insert().

Justin Pettit jpettit at nicira.com
Tue Jun 22 22:34:03 UTC 2010


On Jun 10, 2010, at 5:14 PM, Ben Pfaff wrote:

> There's no need to allocate row->written ahead of time because the code
> that can use it allocates it on demand if row->written is NULL.
> ---
> lib/ovsdb-idl.c |    1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
> index 23d00a8..1bd953c 100644
> --- a/lib/ovsdb-idl.c
> +++ b/lib/ovsdb-idl.c
> @@ -1509,7 +1509,6 @@ ovsdb_idl_txn_insert(struct ovsdb_idl_txn *txn,
>     uuid_generate(&row->uuid);
>     row->table = ovsdb_idl_table_from_class(txn->idl, class);
>     row->new = xmalloc(class->n_columns * sizeof *row->new);
> -    row->written = bitmap_allocate(class->n_columns);

There are a few spots in ovsdb-idl.c that perform operations on row->written without first checking for its existence.  Are you sure that those are only executed if ovsdb_idl_txn_write() has run?

--Justin






More information about the dev mailing list