MCPcopy Index your code
hub / github.com/coder/coder / normalizePathBytes

Function normalizePathBytes

agent/filefinder/text.go:37–58  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

35}
36
37func normalizePathBytes(p []byte) []byte {
38 j := 0
39 prevSlash := false
40 for i := 0; i < len(p); i++ {
41 c := p[i]
42 if c == '\\' {
43 c = '/'
44 }
45 c = toLowerASCII(c)
46 if c == '/' {
47 if prevSlash {
48 continue
49 }
50 prevSlash = true
51 } else {
52 prevSlash = false
53 }
54 p[j] = c
55 j++
56 }
57 return p[:j]
58}
59
60// extractTrigrams returns deduplicated, sorted trigrams (three-byte
61// subsequences) from s. Trigrams are the primary index key: a

Callers 3

AddMethod · 0.85
RemoveMethod · 0.85
HasMethod · 0.85

Calls 1

toLowerASCIIFunction · 0.85

Tested by

no test coverage detected