diff options
author | red-001 <red-001@outlook.ie> | 2017-02-18 14:24:49 +0000 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-02-18 15:24:49 +0100 |
commit | d988f9b7694de2155425fa109523bb6f44d643ea (patch) | |
tree | ab897ae4e1cbb75adcc04b05880490cac8f73038 | |
parent | 3d25914986845dcb789d372ec7c20d15e310572a (diff) | |
download | minetest-d988f9b7694de2155425fa109523bb6f44d643ea.tar.gz minetest-d988f9b7694de2155425fa109523bb6f44d643ea.tar.bz2 minetest-d988f9b7694de2155425fa109523bb6f44d643ea.zip |
Use the `ARRLEN` macro in more places and remove an unused macro. (#5260)
-rw-r--r-- | src/clientiface.h | 1 | ||||
-rw-r--r-- | src/keycode.cpp | 8 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/clientiface.h b/src/clientiface.h index 551d71bbe..f002f37fb 100644 --- a/src/clientiface.h +++ b/src/clientiface.h @@ -165,7 +165,6 @@ namespace con { class Connection; } -#define CI_ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0])) // Also make sure to update the ClientInterface::statenames // array when modifying these enums diff --git a/src/keycode.cpp b/src/keycode.cpp index 2e211ad59..66708fb19 100644 --- a/src/keycode.cpp +++ b/src/keycode.cpp @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "debug.h" #include "util/hex.h" #include "util/string.h" +#include "util/basic_macros.h" class UnknownKeycode : public BaseException { @@ -242,11 +243,10 @@ static const struct table_key table[] = { #undef N_ -#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0])) struct table_key lookup_keyname(const char *name) { - for (u16 i = 0; i < ARRAYSIZE(table); i++) { + for (u16 i = 0; i < ARRLEN(table); i++) { if (strcmp(table[i].Name, name) == 0) return table[i]; } @@ -256,7 +256,7 @@ struct table_key lookup_keyname(const char *name) struct table_key lookup_keykey(irr::EKEY_CODE key) { - for (u16 i = 0; i < ARRAYSIZE(table); i++) { + for (u16 i = 0; i < ARRLEN(table); i++) { if (table[i].Key == key) return table[i]; } @@ -268,7 +268,7 @@ struct table_key lookup_keykey(irr::EKEY_CODE key) struct table_key lookup_keychar(wchar_t Char) { - for (u16 i = 0; i < ARRAYSIZE(table); i++) { + for (u16 i = 0; i < ARRLEN(table); i++) { if (table[i].Char == Char) return table[i]; } |