ADVAPI32: make ADVAPI_IsLocalComputer static and simplify it a little

Mike McCormack mike at codeweavers.com
Wed Jun 8 22:36:33 CDT 2005


ChangeLog:
* make ADVAPI_IsLocalComputer static and simplify it a little
-------------- next part --------------
Index: dlls/advapi32/security.c
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/security.c,v
retrieving revision 1.102
diff -u -p -r1.102 security.c
--- dlls/advapi32/security.c	22 Apr 2005 21:17:42 -0000	1.102
+++ dlls/advapi32/security.c	9 Jun 2005 03:38:24 -0000
@@ -137,31 +137,23 @@ static void GetWorldAccessACL(PACL pACL)
  *
  * Checks whether the server name indicates local machine.
  */
-BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
+static BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
 {
-    if (!ServerName)
-    {
-        return TRUE;
-    }
-    else if (!ServerName[0])
-    {
-        return TRUE;
-    }
-    else
-    {
-        DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
-        BOOL Result;
-        LPWSTR buf;
+    DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
+    BOOL Result;
+    LPWSTR buf;
 
-        buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
-        Result = GetComputerNameW(buf,  &dwSize);
-        if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
-            ServerName += 2;
-        Result = Result && !lstrcmpW(ServerName, buf);
-        HeapFree(GetProcessHeap(), 0, buf);
+    if (!ServerName || !ServerName[0])
+        return TRUE;
+    
+    buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
+    Result = GetComputerNameW(buf,  &dwSize);
+    if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
+        ServerName += 2;
+    Result = Result && !lstrcmpW(ServerName, buf);
+    HeapFree(GetProcessHeap(), 0, buf);
 
-        return Result;
-    }
+    return Result;
 }
 
 #define ADVAPI_ForceLocalComputer(ServerName, FailureCode) \


More information about the wine-patches mailing list