s3: Avoid two calls to strcmp()
authorVolker Lendecke <vl@samba.org>
Sat, 21 Nov 2009 15:15:16 +0000 (16:15 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 21 Nov 2009 19:49:16 +0000 (20:49 +0100)
source3/lib/util.c

index 9d12e5b56097cd14f65fb038219fddfb62c148fb..6348ddc19364ebbfabe9a9aa7f2c9d37d369af6b 100644 (file)
@@ -2386,9 +2386,9 @@ bool ms_has_wild_w(const smb_ucs2_t *s)
 
 bool mask_match(const char *string, const char *pattern, bool is_case_sensitive)
 {
-       if (strcmp(string,"..") == 0)
+       if (ISDOTDOT(string))
                string = ".";
-       if (strcmp(pattern,".") == 0)
+       if (ISDOT(pattern))
                return False;
        
        return ms_fnmatch(pattern, string, Protocol <= PROTOCOL_LANMAN2, is_case_sensitive) == 0;
@@ -2402,9 +2402,9 @@ bool mask_match(const char *string, const char *pattern, bool is_case_sensitive)
 
 bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive)
 {
-       if (strcmp(string,"..") == 0)
+       if (ISDOTDOT(string))
                string = ".";
-       if (strcmp(pattern,".") == 0)
+       if (ISDOT(pattern))
                return False;
        
        return ms_fnmatch(pattern, string, True, is_case_sensitive) == 0;