aboutsummaryrefslogtreecommitdiff
path: root/arch/i386/boot
diff options
context:
space:
mode:
authorRobert P. J. Day <rpjday@mindspring.com>2007-02-17 19:10:01 +0100
committerAdrian Bunk <bunk@stusta.de>2007-02-17 19:10:01 +0100
commitca820181fc187af316a18b2700582663662c4012 (patch)
tree83d6fe8614964b1b2c0658ca99b104e0b61ded07 /arch/i386/boot
parentd08df601a30df9e36c29f3214315f4f0c8784c68 (diff)
Use ARRAY_SIZE() macro in i386 relocs.c file
Change the explicit code in the relocs.c file to use ARRAY_SIZE() and add a definition of ARRAY_SIZE() since this is a userspace program and wouldn't include kernel.h. Signed-off-by: Robert P. J. Day <rpjday@mindspring.com> Signed-off-by: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'arch/i386/boot')
-rw-r--r--arch/i386/boot/compressed/relocs.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/i386/boot/compressed/relocs.c b/arch/i386/boot/compressed/relocs.c
index 881951ca03e..ce4fda261aa 100644
--- a/arch/i386/boot/compressed/relocs.c
+++ b/arch/i386/boot/compressed/relocs.c
@@ -11,6 +11,7 @@
#include <endian.h>
#define MAX_SHDRS 100
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
static Elf32_Ehdr ehdr;
static Elf32_Shdr shdr[MAX_SHDRS];
static Elf32_Sym *symtab[MAX_SHDRS];
@@ -71,7 +72,7 @@ static const char *sym_type(unsigned type)
#undef SYM_TYPE
};
const char *name = "unknown sym type name";
- if (type < sizeof(type_name)/sizeof(type_name[0])) {
+ if (type < ARRAY_SIZE(type_name)) {
name = type_name[type];
}
return name;
@@ -87,7 +88,7 @@ static const char *sym_bind(unsigned bind)
#undef SYM_BIND
};
const char *name = "unknown sym bind name";
- if (bind < sizeof(bind_name)/sizeof(bind_name[0])) {
+ if (bind < ARRAY_SIZE(bind_name)) {
name = bind_name[bind];
}
return name;
@@ -104,7 +105,7 @@ static const char *sym_visibility(unsigned visibility)
#undef SYM_VISIBILITY
};
const char *name = "unknown sym visibility name";
- if (visibility < sizeof(visibility_name)/sizeof(visibility_name[0])) {
+ if (visibility < ARRAY_SIZE(visibility_name)) {
name = visibility_name[visibility];
}
return name;
@@ -128,7 +129,7 @@ static const char *rel_type(unsigned type)
#undef REL_TYPE
};
const char *name = "unknown type rel type name";
- if (type < sizeof(type_name)/sizeof(type_name[0])) {
+ if (type < ARRAY_SIZE(type_name)) {
name = type_name[type];
}
return name;