[PATCH] winhttp: Avoid a variable that holds an ARRAY_SIZE() result
Michael Stefaniuc
mstefani at winehq.org
Tue Sep 25 12:35:01 CDT 2018
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/winhttp/request.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 33d86823be..24e4b555d9 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -866,13 +866,12 @@ auth_schemes[] =
{ digestW, ARRAY_SIZE(digestW) - 1, WINHTTP_AUTH_SCHEME_DIGEST },
{ negotiateW, ARRAY_SIZE(negotiateW) - 1, WINHTTP_AUTH_SCHEME_NEGOTIATE }
};
-static const unsigned int num_auth_schemes = sizeof(auth_schemes)/sizeof(auth_schemes[0]);
static enum auth_scheme scheme_from_flag( DWORD flag )
{
int i;
- for (i = 0; i < num_auth_schemes; i++) if (flag == auth_schemes[i].scheme) return i;
+ for (i = 0; i < ARRAY_SIZE( auth_schemes ); i++) if (flag == auth_schemes[i].scheme) return i;
return SCHEME_INVALID;
}
@@ -880,7 +879,7 @@ static DWORD auth_scheme_from_header( WCHAR *header )
{
unsigned int i;
- for (i = 0; i < num_auth_schemes; i++)
+ for (i = 0; i < ARRAY_SIZE( auth_schemes ); i++)
{
if (!strncmpiW( header, auth_schemes[i].str, auth_schemes[i].len ) &&
(header[auth_schemes[i].len] == ' ' || !header[auth_schemes[i].len])) return auth_schemes[i].scheme;
@@ -2310,7 +2309,7 @@ static BOOL handle_authorization( request_t *request, DWORD status )
if (do_authorization( request, target, first )) return TRUE;
schemes &= ~first;
- for (i = 0; i < num_auth_schemes; i++)
+ for (i = 0; i < ARRAY_SIZE( auth_schemes ); i++)
{
if (!(schemes & auth_schemes[i].scheme)) continue;
if (do_authorization( request, target, auth_schemes[i].scheme )) return TRUE;
--
2.14.4
More information about the wine-devel
mailing list