Commit 38ba364c authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

krnl386.exe16: Avoid ARRAY_SIZE-like macros.

parent de8c478c
......@@ -193,8 +193,6 @@ static const struct {
};
#undef ErrorString
#define ErrorStringCount (sizeof(ErrorStrings) / sizeof(ErrorStrings[0]))
#define ParamErrorStringCount (sizeof(ParamErrorStrings) / sizeof(ParamErrorStrings[0]))
/***********************************************************************
* GetErrorString (internal)
......@@ -204,7 +202,7 @@ static const char *GetErrorString(UINT16 uErr)
static char buffer[80];
unsigned int n;
for (n = 0; n < ErrorStringCount; n++) {
for (n = 0; n < ARRAY_SIZE(ErrorStrings); n++) {
if (uErr == ErrorStrings[n].constant)
return ErrorStrings[n].name;
}
......@@ -229,7 +227,7 @@ static const char *GetParamErrorString(UINT16 uErr) {
{
unsigned int n;
for (n = 0; n < ParamErrorStringCount; n++) {
for (n = 0; n < ARRAY_SIZE(ParamErrorStrings); n++) {
if (uErr == ParamErrorStrings[n].constant) {
strcat(buffer, ParamErrorStrings[n].name);
return buffer;
......
......@@ -282,8 +282,6 @@ static struct magic_device magic_devices[] =
{ {'h','p','s','c','a','n',0}, NULL, { { 0, 0 } }, INT21_IoctlHPScanHandler },
};
#define NB_MAGIC_DEVICES (sizeof(magic_devices)/sizeof(magic_devices[0]))
/* Many calls translate a drive argument like this:
drive number (00h = default, 01h = A:, etc)
......@@ -856,13 +854,13 @@ static HANDLE INT21_OpenMagicDevice( LPCWSTR name, DWORD access )
if ((p = strrchrW( name, '/' ))) name = p + 1;
if ((p = strrchrW( name, '\\' ))) name = p + 1;
for (i = 0; i < NB_MAGIC_DEVICES; i++)
for (i = 0; i < ARRAY_SIZE(magic_devices); i++)
{
int len = strlenW( magic_devices[i].name );
if (!strncmpiW( magic_devices[i].name, name, len ) &&
(!name[len] || name[len] == '.' || name[len] == ':')) break;
}
if (i == NB_MAGIC_DEVICES) return 0;
if (i == ARRAY_SIZE(magic_devices)) return 0;
if (!magic_devices[i].handle) /* need to open it */
{
......@@ -2639,7 +2637,7 @@ static void INT21_Ioctl_Char( CONTEXT *context )
}
} else {
UINT i;
for (i = 0; i < NB_MAGIC_DEVICES; i++)
for (i = 0; i < ARRAY_SIZE(magic_devices); i++)
{
if (!magic_devices[i].handle) continue;
if (magic_devices[i].index.QuadPart == info.IndexNumber.QuadPart)
......
......@@ -80,8 +80,6 @@ static struct vxdcall_service vxd_services[] =
{ {'v','w','i','n','3','2','.','v','x','d',0}, 0x002a, NULL, NULL }
};
#define NB_VXD_SERVICES (sizeof(vxd_services)/sizeof(vxd_services[0]))
#define W32S_APP2WINE(addr) ((addr)? (DWORD)(addr) + W32S_offset : 0)
#define W32S_WINE2APP(addr) ((addr)? (DWORD)(addr) - W32S_offset : 0)
......@@ -293,7 +291,7 @@ void WINAPI DECLSPEC_HIDDEN __regs_VxDCall( CONTEXT *context )
DWORD service = stack32_pop( context );
RtlEnterCriticalSection( &vxd_section );
for (i = 0; i < NB_VXD_SERVICES; i++)
for (i = 0; i < ARRAY_SIZE(vxd_services); i++)
{
if (HIWORD(service) != vxd_services[i].service) continue;
if (!vxd_services[i].module) /* need to load it */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment