Skip to content

Commit

Permalink
fix: simplify some expressions in glob matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Oct 11, 2020
1 parent 968cc5c commit be621af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sql/query/glob/like.go
Expand Up @@ -81,7 +81,7 @@ func MatchLike(pattern, s string) bool {
// 3. p is an unescaped escape character, or
// 4. p is to be handled as an ordinary character
//
if p == matchAll && !prevEscape && p != matchEsc {
if p == matchAll && !prevEscape {
// Case 1.
var c byte

Expand Down Expand Up @@ -116,7 +116,7 @@ func MatchLike(pattern, s string) bool {
s = skipRune(s)
}
return false
} else if p == matchOne && !prevEscape && p != matchEsc {
} else if p == matchOne && !prevEscape {
// Case 2.
if len(s) == 0 {
return false
Expand Down
2 changes: 1 addition & 1 deletion sql/query/glob/like_test.go
Expand Up @@ -37,7 +37,7 @@ func TestMatchLike(t *testing.T) {

// Exact
{"abc", "abc", true},
{"aBc", "AbC", true},
{"aBc", "AbC", false},
{"abc", "def", false},

// Prefix
Expand Down

0 comments on commit be621af

Please sign in to comment.