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

Ben Pfaff blp at nicira.com
Wed Jun 23 17:16:58 UTC 2010


On Tue, Jun 22, 2010 at 03:34:03PM -0700, Justin Pettit wrote:
> 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?

All of those spots appear to me to first check that row->old !=
row->new, in which case we know that row->written != NULL since the two
go hand-in-hand.




More information about the dev mailing list