aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-02-07 22:32:00 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-02-07 22:32:00 +0000
commit10bfba3f5ab2c13fd28ffb1ec204f03f52c2d4f6 (patch)
tree7b463e25ee9a7e7acf4794ce8514e100c4d02366
parent9c217903782672fb9ad3d5fd0f24152d3225843f (diff)
parenteeeac5ffc184d1484045af8ea4de89b0bdbdf776 (diff)
downloadblueprint-10bfba3f5ab2c13fd28ffb1ec204f03f52c2d4f6.tar.gz
Merge "Rename saneSplit --> quickSplit" am: fc56ef6e20 am: bbd604b48a am: 3b3738c58a am: eeeac5ffc1
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1974127 Change-Id: I040658cb6dab453922d4ac75f95b49c2ae354464
-rw-r--r--pathtools/fs.go14
-rw-r--r--pathtools/glob.go4
2 files changed, 9 insertions, 9 deletions
diff --git a/pathtools/fs.go b/pathtools/fs.go
index 806f466..ed1251b 100644
--- a/pathtools/fs.go
+++ b/pathtools/fs.go
@@ -245,7 +245,7 @@ type mockFs struct {
}
func (m *mockFs) followSymlinks(name string) string {
- dir, file := saneSplit(name)
+ dir, file := quickSplit(name)
if dir != "." && dir != "/" {
dir = m.followSymlinks(dir)
}
@@ -330,7 +330,7 @@ func (m *mockFs) IsDir(name string) (bool, error) {
}
func (m *mockFs) IsSymlink(name string) (bool, error) {
- dir, file := saneSplit(name)
+ dir, file := quickSplit(name)
dir = m.followSymlinks(dir)
name = filepath.Join(dir, file)
@@ -363,14 +363,14 @@ func unescapeGlob(s string) string {
}
func (m *mockFs) glob(pattern string) ([]string, error) {
- dir, file := saneSplit(pattern)
+ dir, file := quickSplit(pattern)
dir = unescapeGlob(dir)
toDir := m.followSymlinks(dir)
var matches []string
for _, f := range m.all {
- fDir, fFile := saneSplit(f)
+ fDir, fFile := quickSplit(f)
if toDir == fDir {
match, err := filepath.Match(file, fFile)
if err != nil {
@@ -402,7 +402,7 @@ func (ms *mockStat) ModTime() time.Time { return time.Time{} }
func (ms *mockStat) Sys() interface{} { return nil }
func (m *mockFs) Lstat(name string) (os.FileInfo, error) {
- dir, file := saneSplit(name)
+ dir, file := quickSplit(name)
dir = m.followSymlinks(dir)
name = filepath.Join(dir, file)
@@ -464,7 +464,7 @@ func (m *mockFs) ReadDirNames(name string) ([]string, error) {
var ret []string
for _, f := range m.all {
- dir, file := saneSplit(f)
+ dir, file := quickSplit(f)
if dir == name && len(file) > 0 && file[0] != '.' {
ret = append(ret, file)
}
@@ -477,7 +477,7 @@ func (m *mockFs) ListDirsRecursive(name string, follow ShouldFollowSymlinks) ([]
}
func (m *mockFs) Readlink(name string) (string, error) {
- dir, file := saneSplit(name)
+ dir, file := quickSplit(name)
dir = m.followSymlinks(dir)
origName := name
diff --git a/pathtools/glob.go b/pathtools/glob.go
index f60e772..5b2d685 100644
--- a/pathtools/glob.go
+++ b/pathtools/glob.go
@@ -176,7 +176,7 @@ func glob(fs FileSystem, pattern string, hasRecursive bool,
return matches, dirs, err
}
- dir, file := saneSplit(pattern)
+ dir, file := quickSplit(pattern)
if file == "**" {
if hasRecursive {
@@ -230,7 +230,7 @@ func glob(fs FileSystem, pattern string, hasRecursive bool,
// Faster version of dir, file := filepath.Dir(path), filepath.File(path) with no allocations
// Similar to filepath.Split, but returns "." if dir is empty and trims trailing slash if dir is
// not "/". Returns ".", "" if path is "."
-func saneSplit(path string) (dir, file string) {
+func quickSplit(path string) (dir, file string) {
if path == "." {
return ".", ""
}