aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElyes Haouas <ehaouas@noos.fr>2023-11-07 17:10:52 +0000
committerWarner Losh <imp@FreeBSD.org>2024-04-29 03:24:47 +0000
commit8918cc95e869ce4a9c7fb15221577444a8c66215 (patch)
tree3413241016859d9392b89763aeba46349e2a155c
parentd1d652c060150985e1e580eb57b4b6829f6845c9 (diff)
downloadsrc-8918cc95e869ce4a9c7fb15221577444a8c66215.tar.gz
src-8918cc95e869ce4a9c7fb15221577444a8c66215.zip
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>
-rw-r--r--usr.sbin/btxld/elfh.c6
1 files 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 */
},
{