Michael Stefaniuc : libs/port: Avoid an ARRAY_SIZE-like macro.

Alexandre Julliard julliard at winehq.org
Thu Nov 8 14:47:25 CST 2018


Module: wine
Branch: master
Commit: a0d4401ddc710b06297b906d937ff503a668dda8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a0d4401ddc710b06297b906d937ff503a668dda8

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Wed Nov  7 22:31:46 2018 +0100

libs/port: Avoid an ARRAY_SIZE-like macro.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/port/cptable.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libs/port/cptable.c b/libs/port/cptable.c
index 03264f3..73000c2 100644
--- a/libs/port/cptable.c
+++ b/libs/port/cptable.c
@@ -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];
 }




More information about the wine-cvs mailing list