From ed6191430b27a5447ef2675f2cfe19d8f0b88333 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 21 Jun 2007 11:33:46 +0000 Subject: Add arrlen() macro as a clearer way of doing sizeof(array) / sizeof(*array) Subversion-branch: /trunk/chocolate-doom Subversion-revision: 922 --- setup/configfile.c | 5 +++-- setup/keyboard.c | 3 ++- setup/mouse.c | 3 ++- setup/multiplayer.c | 5 +++-- 4 files changed, 10 insertions(+), 6 deletions(-) (limited to 'setup') diff --git a/setup/configfile.c b/setup/configfile.c index d9b17af2..984df6b2 100644 --- a/setup/configfile.c +++ b/setup/configfile.c @@ -44,6 +44,7 @@ #include "doomfeatures.h" #include "doomkeys.h" +#include "doomtype.h" #include "d_englsh.h" #include "m_argv.h" @@ -243,7 +244,7 @@ static default_t doom_defaults_list[] = static default_collection_t doom_defaults = { doom_defaults_list, - sizeof(doom_defaults_list) / sizeof(*doom_defaults_list), + arrlen(doom_defaults_list), NULL, }; @@ -282,7 +283,7 @@ static default_t extra_defaults_list[] = static default_collection_t extra_defaults = { extra_defaults_list, - sizeof(extra_defaults_list) / sizeof(*extra_defaults_list), + arrlen(extra_defaults_list), NULL, }; diff --git a/setup/keyboard.c b/setup/keyboard.c index e558840a..3a7ccb8f 100644 --- a/setup/keyboard.c +++ b/setup/keyboard.c @@ -19,6 +19,7 @@ // 02111-1307, USA. // #include "textscreen.h" +#include "doomtype.h" #include "execute.h" #include "txt_keyinput.h" @@ -72,7 +73,7 @@ static void KeySetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable)) TXT_CAST_ARG(int, variable); unsigned int i; - for (i=0; i #include "textscreen.h" +#include "doomtype.h" #include "execute.h" #include "txt_mouseinput.h" @@ -64,7 +65,7 @@ static void MouseSetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable)) // Check if the same mouse button is used for a different action // If so, set the other action(s) to -1 (unset) - for (i=0; i