glu32: Avoid an ARRAY_SIZE-like macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-07-05 22:07:21 +02:00 committed by Alexandre Julliard
parent 9477a0ad91
commit de8c478c43
1 changed files with 3 additions and 4 deletions

View File

@ -91,7 +91,6 @@ static const struct { GLuint err; const char *str; } errors[] =
{ GLU_NURBS_ERROR36, "null control point reference" }, { GLU_NURBS_ERROR36, "null control point reference" },
{ GLU_NURBS_ERROR37, "duplicate point on piecewise linear trimming curve" }, { GLU_NURBS_ERROR37, "duplicate point on piecewise linear trimming curve" },
}; };
#define NB_ERRORS (sizeof(errors) / sizeof(errors[0]))
typedef void (*_GLUfuncptr)(void); typedef void (*_GLUfuncptr)(void);
@ -148,7 +147,7 @@ const GLubyte * WINAPI wine_gluErrorString( GLenum errCode )
{ {
unsigned int i; unsigned int i;
for (i = 0; i < NB_ERRORS; i++) for (i = 0; i < ARRAY_SIZE(errors); i++)
if (errors[i].err == errCode) return (const GLubyte *)errors[i].str; if (errors[i].err == errCode) return (const GLubyte *)errors[i].str;
return NULL; return NULL;
@ -159,10 +158,10 @@ const GLubyte * WINAPI wine_gluErrorString( GLenum errCode )
*/ */
const WCHAR * WINAPI wine_gluErrorUnicodeStringEXT( GLenum errCode ) const WCHAR * WINAPI wine_gluErrorUnicodeStringEXT( GLenum errCode )
{ {
static WCHAR errorsW[NB_ERRORS][64]; static WCHAR errorsW[ARRAY_SIZE(errors)][64];
unsigned int i, j; unsigned int i, j;
for (i = 0; i < NB_ERRORS; i++) for (i = 0; i < ARRAY_SIZE(errors); i++)
{ {
if (errors[i].err != errCode) continue; if (errors[i].err != errCode) continue;
if (!errorsW[i][0]) /* errors use only ASCII, do a simple mapping */ if (!errorsW[i][0]) /* errors use only ASCII, do a simple mapping */