Remove some pointer indirections in device.go.

This commit is contained in:
John Beisley 2013-09-29 15:59:53 +01:00
parent a7fffcafdc
commit 69d76cd5e4
2 changed files with 18 additions and 18 deletions

View File

@ -30,8 +30,8 @@ func displayDevice(indent indentLevel, device *goupnp.Device) {
}
}
}
for _, subdev := range device.Devices {
displayDevice(indent+1, subdev)
for i := range device.Devices {
displayDevice(indent+1, &device.Devices[i])
}
}
@ -44,7 +44,7 @@ func main() {
if maybeRootDevice.Err != nil {
fmt.Println(maybeRootDevice.Err)
} else {
displayDevice(0, maybeRootDevice.Root.Device)
displayDevice(0, &maybeRootDevice.Root.Device)
}
}
}

View File

@ -23,7 +23,7 @@ type RootDevice struct {
SpecVersion SpecVersion `xml:"specVersion"`
URLBase url.URL `xml:"-"`
URLBaseStr string `xml:"URLBase"`
Device *Device `xml:"device"`
Device Device `xml:"device"`
}
func (root *RootDevice) SetURLBase(urlBase *url.URL) {
@ -49,9 +49,9 @@ type Device struct {
SerialNumber string `xml:"serialNumber"`
UDN string `xml:"UDN"`
UPC string `xml:"UPC,omitempty"`
Icons []*Icon `xml:"iconList>icon,omitempty"`
Services []*Service `xml:"serviceList>service,omitempty"`
Devices []*Device `xml:"deviceList>device,omitempty"`
Icons []Icon `xml:"iconList>icon,omitempty"`
Services []Service `xml:"serviceList>service,omitempty"`
Devices []Device `xml:"deviceList>device,omitempty"`
// Extra observed elements:
PresentationURL URLField `xml:"presentationURL"`