git: 8918cc95e869 - main - btxld: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Apr 2024 04:27:15 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8918cc95e869ce4a9c7fb15221577444a8c66215 commit 8918cc95e869ce4a9c7fb15221577444a8c66215 Author: Elyes Haouas <ehaouas@noos.fr> AuthorDate: 2023-11-07 17:10:52 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-04-29 03:24:47 +0000 btxld: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0]) Pull Request: https://github.com/freebsd/freebsd-src/pull/888 Signed-off-by: Elyes Haouas <ehaouas@noos.fr> --- usr.sbin/btxld/elfh.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/btxld/elfh.c b/usr.sbin/btxld/elfh.c index 8e9ea16c2cf6..5122aca8b3c9 100644 --- a/usr.sbin/btxld/elfh.c +++ b/usr.sbin/btxld/elfh.c @@ -26,7 +26,7 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/types.h> +#include <sys/param.h> #include <sys/endian.h> #include <stddef.h> @@ -53,9 +53,9 @@ const struct elfh elfhdr = { 0, /* e_flags */ htole16(sizeof(elfhdr.e)), /* e_ehsize */ htole16(sizeof(elfhdr.p[0])), /* e_phentsize */ - htole16(sizeof(elfhdr.p) / sizeof(elfhdr.p[0])), /* e_phnum */ + htole16(nitems(elfhdr.p)), /* e_phnum */ htole16(sizeof(elfhdr.sh[0])), /* e_shentsize */ - htole16(sizeof(elfhdr.sh) / sizeof(elfhdr.sh[0])), /* e_shnum */ + htole16(nitems(elfhdr.sh)), /* e_shnum */ htole16(1) /* e_shstrndx */ }, {