From: Samuel J. Greear Date: Sun, 12 Feb 2012 18:24:26 +0000 (-0700) Subject: objformat - Duplicate NELEM() macro X-Git-Tag: v3.4.0rc~1211^2 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/bf4591b39db818f234a24772af7baa6220fc0480 objformat - Duplicate NELEM() macro * Fix buildworld on DragonFly hosts built before Dec 18, 2010 (2.9). * NELEM() macro was added to sys/param.h on Dec 18, 2010 and objformat was made to use it on May 20, 2011. This broke upgrades for machines running a DragonFly version built prior to Dec 18, 2010 since objformat is built with the hosts headers as part of the cross tools stage. --- diff --git a/usr.bin/objformat/objformat.c b/usr.bin/objformat/objformat.c index d46d0ce843..c723553e6c 100644 --- a/usr.bin/objformat/objformat.c +++ b/usr.bin/objformat/objformat.c @@ -51,6 +51,11 @@ #define OBJFORMAT_PATH_DEFAULT "" #endif +/* Macro for array size */ +#ifndef NELEM +#define NELEM(ary) (sizeof(ary) / sizeof((ary)[0])) +#endif + enum cmd_type { OBJFORMAT, COMPILER, BINUTILS, LINKER }; struct command {