libs/port: Avoid an ARRAY_SIZE-like macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Michael Stefaniuc 2018-11-07 22:31:46 +01:00 committed by Alexandre Julliard
parent 52ed788838
commit a0d4401ddc
1 changed files with 2 additions and 4 deletions

View File

@ -175,8 +175,6 @@ static const union cptable * const cptables[72] =
/* ### cpmap end ### */
/* Everything above this line is generated automatically by make_unicode */
#define NB_CODEPAGES (sizeof(cptables)/sizeof(cptables[0]))
static int cmp_codepage( const void *codepage, const void *entry )
{
@ -189,7 +187,7 @@ const union cptable *wine_cp_get_table( unsigned int codepage )
{
const union cptable **res;
if (!(res = bsearch( &codepage, cptables, NB_CODEPAGES,
if (!(res = bsearch( &codepage, cptables, ARRAY_SIZE( cptables ),
sizeof(cptables[0]), cmp_codepage ))) return NULL;
return *res;
}
@ -198,6 +196,6 @@ const union cptable *wine_cp_get_table( unsigned int codepage )
/* enum valid codepages */
const union cptable *wine_cp_enum_table( unsigned int index )
{
if (index >= NB_CODEPAGES) return NULL;
if (index >= ARRAY_SIZE( cptables )) return NULL;
return cptables[index];
}