mirror of
https://github.com/minetest/minetest.git
synced 2024-12-25 07:32:24 +01:00
Use the ARRLEN
macro in more places and remove an unused macro. (#5260)
This commit is contained in:
parent
3d25914986
commit
d988f9b769
@ -165,7 +165,6 @@ namespace con {
|
|||||||
class Connection;
|
class Connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CI_ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
|
|
||||||
|
|
||||||
// Also make sure to update the ClientInterface::statenames
|
// Also make sure to update the ClientInterface::statenames
|
||||||
// array when modifying these enums
|
// array when modifying these enums
|
||||||
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "util/hex.h"
|
#include "util/hex.h"
|
||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
|
#include "util/basic_macros.h"
|
||||||
|
|
||||||
class UnknownKeycode : public BaseException
|
class UnknownKeycode : public BaseException
|
||||||
{
|
{
|
||||||
@ -242,11 +243,10 @@ static const struct table_key table[] = {
|
|||||||
|
|
||||||
#undef N_
|
#undef N_
|
||||||
|
|
||||||
#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
|
|
||||||
|
|
||||||
struct table_key lookup_keyname(const char *name)
|
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)
|
if (strcmp(table[i].Name, name) == 0)
|
||||||
return table[i];
|
return table[i];
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@ struct table_key lookup_keyname(const char *name)
|
|||||||
|
|
||||||
struct table_key lookup_keykey(irr::EKEY_CODE key)
|
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)
|
if (table[i].Key == key)
|
||||||
return table[i];
|
return table[i];
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ struct table_key lookup_keykey(irr::EKEY_CODE key)
|
|||||||
|
|
||||||
struct table_key lookup_keychar(wchar_t Char)
|
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)
|
if (table[i].Char == Char)
|
||||||
return table[i];
|
return table[i];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user