Skip to content

Commit eb782c5

Browse files
TirelessDevdeadprogram
authored andcommitted
macos: remove unnecessary pointer indirection on service and char maps
1 parent a341e8f commit eb782c5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

gap_darwin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ type Device struct {
9393
servicesChan chan error
9494
charsChan chan error
9595

96-
services map[UUID]*DeviceService
96+
services map[UUID]DeviceService
9797
}
9898

9999
// Connect starts a connection attempt to the given peripheral device address.

gattc_darwin.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func (d *Device) DiscoverServices(uuids []UUID) ([]DeviceService, error) {
1818
d.prph.DiscoverServices([]cbgo.UUID{})
1919

2020
// clear cache of services
21-
d.services = make(map[UUID]*DeviceService)
21+
d.services = make(map[UUID]DeviceService)
2222

2323
// wait on channel for service discovery
2424
select {
@@ -49,7 +49,7 @@ func (d *Device) DiscoverServices(uuids []UUID) ([]DeviceService, error) {
4949
},
5050
}
5151
svcs = append(svcs, svc)
52-
d.services[svc.uuidWrapper] = &svc
52+
d.services[svc.uuidWrapper] = svc
5353
}
5454
return svcs, nil
5555
case <-time.NewTimer(10 * time.Second).C:
@@ -72,7 +72,7 @@ type deviceService struct {
7272
device *Device
7373

7474
service cbgo.Service
75-
characteristics map[UUID]*DeviceCharacteristic
75+
characteristics map[UUID]DeviceCharacteristic
7676
}
7777

7878
// UUID returns the UUID for this DeviceService.
@@ -95,7 +95,7 @@ func (s *DeviceService) DiscoverCharacteristics(uuids []UUID) ([]DeviceCharacter
9595
s.device.prph.DiscoverCharacteristics(cbuuids, s.service)
9696

9797
// clear cache of characteristics
98-
s.characteristics = make(map[UUID]*DeviceCharacteristic)
98+
s.characteristics = make(map[UUID]DeviceCharacteristic)
9999

100100
// wait on channel for characteristic discovery
101101
select {
@@ -150,7 +150,7 @@ func (s *DeviceService) makeCharacteristic(uuid UUID, dchar cbgo.Characteristic)
150150
characteristic: dchar,
151151
},
152152
}
153-
s.characteristics[char.uuidWrapper] = &char
153+
s.characteristics[char.uuidWrapper] = char
154154
return char
155155
}
156156

0 commit comments

Comments
 (0)