[ovs-dev] [flow monitor v2 08/12] rconn: Add byte counting feature to rconn_packet_counter.
Ben Pfaff
blp at nicira.com
Thu Jul 12 17:15:29 UTC 2012
On Sat, Jul 07, 2012 at 03:25:28PM -0700, Justin Pettit wrote:
> On Jul 6, 2012, at 2:49 PM, Ben Pfaff wrote:
>
> > @@ -873,7 +875,8 @@ struct rconn_packet_counter *
> > rconn_packet_counter_create(void)
> > {
> > struct rconn_packet_counter *c = xmalloc(sizeof *c);
> > - c->n = 0;
> > + c->n_packets = 0;
> > + c->n_bytes = 0;
> > c->ref_cnt = 1;
>
> Do you think it's just worth calling xzalloc() at this point?
I'm ambivalent, so I changed it:
diff --git a/lib/rconn.c b/lib/rconn.c
index 0a41d51..1129a3b 100644
--- a/lib/rconn.c
+++ b/lib/rconn.c
@@ -874,9 +874,7 @@ rconn_count_txqlen(const struct rconn *rc)
struct rconn_packet_counter *
rconn_packet_counter_create(void)
{
- struct rconn_packet_counter *c = xmalloc(sizeof *c);
- c->n_packets = 0;
- c->n_bytes = 0;
+ struct rconn_packet_counter *c = xzalloc(sizeof *c);
c->ref_cnt = 1;
return c;
}
More information about the dev
mailing list