Skip to content

Commit f762b44

Browse files
committed
Inlined function call
1 parent 417bbc5 commit f762b44

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

serial.go

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,12 @@ func (sp *SerialPortList) Update() {
147147
// Empty port list if they can not be detected
148148
ports = []*OsSerialPort{}
149149
}
150-
list := spListDual(ports)
151150

152-
serialPorts.portsLock.Lock()
153-
serialPorts.Ports = list
154-
serialPorts.portsLock.Unlock()
155-
}
156-
157-
func spListDual(list []*OsSerialPort) []SpPortItem {
158151
// we have a full clean list of ports now. iterate thru them
159152
// to append the open/close state, baud rates, etc to make
160153
// a super clean nice list to send back to browser
161-
spl := []SpPortItem{}
162-
163-
for _, item := range list {
154+
list := []SpPortItem{}
155+
for _, item := range ports {
164156
port := SpPortItem{
165157
Name: item.Name,
166158
SerialNumber: item.ISerial,
@@ -181,9 +173,12 @@ func spListDual(list []*OsSerialPort) []SpPortItem {
181173
port.Baud = myport.portConf.Baud
182174
port.BufferAlgorithm = myport.BufferType
183175
}
184-
spl = append(spl, port)
176+
list = append(list, port)
185177
}
186-
return spl
178+
179+
serialPorts.portsLock.Lock()
180+
serialPorts.Ports = list
181+
serialPorts.portsLock.Unlock()
187182
}
188183

189184
func spErr(err string) {

0 commit comments

Comments
 (0)