On Fri, Jul 29, 2016 at 03:17:19PM -0700, Jarno Rajahalme wrote:
>
> > On Jul 29, 2016, at 12:46 PM, Ben Pfaff <[email protected]> wrote:
> >
> > On Thu, Jul 28, 2016 at 05:55:58PM -0700, Jarno Rajahalme wrote:
> >> Define rule_collection in terms of a new ofproto_collection. This
> >> makes it easier to add other types of collections later.
> >>
> >> This patch makes no functional changes.
> >>
> >> Signed-off-by: Jarno Rajahalme <[email protected]>
> >
> > Is there anything ofproto-specific about these collections? They might
> > be appropriate as a generic data structure in lib/.
> >
>
> There is a small dependency for the _ref() and _unref() functions.
> I added lib/object-collection.[ch] for the generic parts, and kept the
> ofproto dependent parts in ofproto-provider.h.
>
> > At some point it becomes easier to implement this kind of thing as an
> > #include file than as a long \-delimited macro. Then you also get the
> > benefit that you can define macros in the #include file.
>
> Elaborate a bit, I don't get what you mean.
Instead of defining with
#define TEMPLATE(A, B, C) \
...line 1... \
...line 2... \
...line 3...
and then using with TEMPLATE(x, y, z) later, you create a file
template.inc that contains:
...line 1...
...line 2...
...line 3...
#undef A
#undef B
#undef C
and use it with
#define A x
#define B y
#define C z
#include "template.inc"
The advantages are that you don't need ugly \s everywhere and that
template.inc can contain #define and #ifdef and so on. The
disadvantages are that you need another file and that invocation needs
#defines instead of just some parameters. It's always a judgment call
for me.
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev