[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B7429@saturn3.aculab.com>
Date: Mon, 18 Nov 2013 09:54:13 -0000
From: "David Laight" <David.Laight@...LAB.COM>
To: "David Miller" <davem@...emloft.net>, <johannes@...solutions.net>
Cc: <netdev@...r.kernel.org>, <johannes.berg@...el.com>
Subject: RE: [PATCH] genetlink: unify registration functions
> As a future simplification perhaps we can even elide the array length
> argument. Most pass ARRAY_SIZE(foo) but there is at least one case
> (DLM) which passes a constant, which is error prone.
>
> #define genl_register_family_with_ops(family, ops)
> __genl_register_family_with_ops(family, ops, ARRAY_SIZE(ops))
>
> something like that.
Probably best to add a compile time check that ARRAY_SIZE(ops)
isn't zero - as might happen if a pointer is passed.
In some cases this can happen even when the source code appears
to contain the array size.
Or does ARRAY_SIZE(x) already contain a check that
sizeof(x) % sizeof(*(x)) is zero?
David
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists