internal/uidriver: Optimization

This commit is contained in:
Hajime Hoshi 2021-01-26 01:02:24 +09:00
parent b8694aa66a
commit 2dadfdb88e
3 changed files with 3 additions and 3 deletions

View File

@ -164,12 +164,12 @@ func (i *Input) TouchIDs() []driver.TouchID {
return nil
}
var ids []driver.TouchID
i.ui.m.RLock()
defer i.ui.m.RUnlock()
if len(i.touches) == 0 {
return nil
}
ids := make([]driver.TouchID, 0, len(i.touches))
for id := range i.touches {
ids = append(ids, id)
}

View File

@ -163,7 +163,7 @@ func (i *Input) TouchIDs() []driver.TouchID {
return nil
}
var ids []driver.TouchID
ids := make([]driver.TouchID, 0, len(i.touches))
for id := range i.touches {
ids = append(ids, id)
}

View File

@ -144,7 +144,7 @@ func (i *Input) TouchIDs() []driver.TouchID {
return nil
}
var ids []driver.TouchID
ids := make([]driver.TouchID, 0, len(i.touches))
for id := range i.touches {
ids = append(ids, id)
}