diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-11-23 12:43:38 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-11-23 12:43:38 +0000 |
commit | c7ba3e6a6ebc0ed5212d46d88b304eff40501345 (patch) | |
tree | 23505b942c91d5fc217ddeb30397f1164b3acfe9 | |
parent | bff5e2d330b79ad79b90e59ef490bc9ff91e560c (diff) |
this adds:
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
in the kernel, you can now use this instead of torturing yourself.
ok dlg, well, really i just finally gave in to his arguments and we choose
a better name than sizeofa().
-rw-r--r-- | sys/sys/param.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/sys/param.h b/sys/sys/param.h index 9cc9eb7d2cd..2a743dd0a9a 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.78 2008/10/18 12:11:30 kettenis Exp $ */ +/* $OpenBSD: param.h,v 1.79 2008/11/23 12:43:37 deraadt Exp $ */ /* $NetBSD: param.h,v 1.23 1996/03/17 01:02:29 thorpej Exp $ */ /*- @@ -197,6 +197,8 @@ #define offsetof(s, e) ((size_t)&((s *)0)->e) #endif +#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) + /* * Constants for setting the parameters of the kernel memory allocator. * |