From 393075b14f24709ffd2bbaf7448397ed88bc4122 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 19 Jan 2008 11:11:09 +0100 Subject: [PATCH] Clean up handling of syscall names. --- src/box.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/box.c b/src/box.c index 41a894e..d6b820d 100644 --- a/src/box.c +++ b/src/box.c @@ -91,10 +91,10 @@ msg(char *msg, ...) va_end(args); } -static const char * const syscall_tab[] = { +static const char * const syscall_names[] = { #include "syscall-table.h" }; -#define NUM_SYSCALLS (sizeof(syscall_tab)/sizeof(syscall_tab[0])) +#define NUM_SYSCALLS ARRAY_SIZE(syscall_names) #define NUM_ACTIONS (NUM_SYSCALLS+64) enum action { @@ -210,8 +210,8 @@ static unsigned char syscall_action[NUM_ACTIONS] = { static const char * syscall_name(unsigned int id, char *buf) { - if (id < NUM_SYSCALLS && syscall_tab[id]) - return syscall_tab[id]; + if (id < NUM_SYSCALLS && syscall_names[id]) + return syscall_names[id]; else { sprintf(buf, "#%d", id); @@ -222,8 +222,8 @@ syscall_name(unsigned int id, char *buf) static int syscall_by_name(char *name) { - for (unsigned int i=0; i= (int)NUM_ACTIONS) + if (sys >= NUM_ACTIONS) die("Syscall `%s' out of range", a); syscall_action[sys] = act; return 1; -- 2.39.2