mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
Add more performance and memory optimizations
This commit is contained in:
@@ -2,11 +2,11 @@ package highlight
|
||||
|
||||
func DetectFiletype(defs []*Def, filename string, firstLine []byte) *Def {
|
||||
for _, d := range defs {
|
||||
if isMatch, _ := d.ftdetect[0].MatchString(filename); isMatch {
|
||||
if d.ftdetect[0].MatchString(filename) {
|
||||
return d
|
||||
}
|
||||
if len(d.ftdetect) > 1 {
|
||||
if isMatch, _ := d.ftdetect[1].MatchString(string(firstLine)); isMatch {
|
||||
if d.ftdetect[1].MatchString(string(firstLine)) {
|
||||
return d
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user