forked from torvalds/linux
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
linux/kernel.h, linux/array_size.h: Split ARRAY_SIZE() into a separat…
…e header Include <linux/array_size.h> from <linux/kernel.h> for compatibility. Include <linux/compiler.h> for __must_be_array(). Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
- Loading branch information
1 parent
d22f059
commit f4bee28948d96faeac8bdf5ac6d2abdd718d1db3
Showing
2 changed files
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0 */ | ||
| #ifndef _LINUX_ARRAY_SIZE_H | ||
| #define _LINUX_ARRAY_SIZE_H | ||
|
|
||
| #include <linux/compiler.h> | ||
|
|
||
|
|
||
| /** | ||
| * ARRAY_SIZE - get the number of elements in array @a | ||
| * @a: array to be sized | ||
| */ | ||
| #define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]) + __must_be_array(a)) | ||
|
|
||
|
|
||
| #endif /* _LINUX_ARRAY_SIZE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters