aboutsummaryrefslogtreecommitdiff
path: root/src/keycode.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
committerShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
commitcaecdb681c428c1aab9c0f7eec2570c0460f995c (patch)
treee5115982ea59bbf2343ba9b35bc4a0cfbb56f407 /src/keycode.cpp
parent81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (diff)
parent80dc961d24e1964e25d57039ddb2ba639f9f4d22 (diff)
downloadminetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.gz
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.bz2
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.zip
Merge 0.4.16 into stable-0.4
Diffstat (limited to 'src/keycode.cpp')
-rw-r--r--src/keycode.cpp8
1 files changed, 4 insertions, 4 deletions
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];
}